Click here to Skip to main content
15,900,108 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWindow Painting Problem Pin
Nishad S16-Nov-05 1:32
Nishad S16-Nov-05 1:32 
AnswerRe: Window Painting Problem Pin
BlackDice16-Nov-05 8:02
BlackDice16-Nov-05 8:02 
GeneralRe: Window Painting Problem Pin
Nishad S16-Nov-05 17:12
Nishad S16-Nov-05 17:12 
QuestionProblems writting in a spesific font Pin
NastradamuS16-Nov-05 0:50
NastradamuS16-Nov-05 0:50 
AnswerRe: Problems writting in a spesific font Pin
*Dreamz16-Nov-05 1:41
*Dreamz16-Nov-05 1:41 
QuestionSetFolderImageList? Pin
gzy900116-Nov-05 0:45
gzy900116-Nov-05 0:45 
Questionknow if the object is created or not Pin
Russell'16-Nov-05 0:29
Russell'16-Nov-05 0:29 
AnswerRe: know if the object is created or not Pin
Maximilien16-Nov-05 0:51
Maximilien16-Nov-05 0:51 
( I assume that what you wrote in your question is what you have in your real code )
Well, you should go back to to your C++ books ...

in fun1 you create a local variable pEdit which will leak memory when the function ends; same thing in fun2

in fun3 you access a variable that is not allocated yet, so it will crash.


NOW, assuming that what you wrote is not actually your real code and that you pass pEdit as a parameeter to fun3, check to see if pEdit is NULL before trying to access it :

fun3( CEdit* pEdit )
{
 if ( pEdit )
  pEdit->SetWindowText("...");
}


If when calling fun3 your not certain that pEdit is Createed, you can check with CWnd::GetSafeHwnd ( or something similar ).




Maximilien Lincourt
Your Head A Splode - Strong Bad
GeneralRe: know if the object is created or not Pin
Russell'16-Nov-05 1:46
Russell'16-Nov-05 1:46 
GeneralRe: know if the object is created or not Pin
Maximilien16-Nov-05 2:29
Maximilien16-Nov-05 2:29 
GeneralRe: know if the object is created or not Pin
Russell'16-Nov-05 3:45
Russell'16-Nov-05 3:45 
GeneralRe: know if the object is created or not Pin
Blake Miller16-Nov-05 9:10
Blake Miller16-Nov-05 9:10 
AnswerRe: know if the object is created or not Pin
toxcct16-Nov-05 1:02
toxcct16-Nov-05 1:02 
AnswerRe: know if the object is created or not Pin
Cool Ju16-Nov-05 1:07
Cool Ju16-Nov-05 1:07 
Questionhow to indicate Sort icon in the list control on column header Pin
K. narasimharao15-Nov-05 23:40
K. narasimharao15-Nov-05 23:40 
AnswerRe: how to indicate Sort icon in the list control on column header Pin
*Dreamz16-Nov-05 2:04
*Dreamz16-Nov-05 2:04 
QuestionShow and close dialog Pin
trunghd15-Nov-05 22:34
trunghd15-Nov-05 22:34 
AnswerRe: Show and close dialog Pin
Steen Krogsgaard15-Nov-05 22:46
Steen Krogsgaard15-Nov-05 22:46 
GeneralRe: Show and close dialog Pin
trunghd16-Nov-05 0:25
trunghd16-Nov-05 0:25 
GeneralRe: Show and close dialog Pin
toxcct16-Nov-05 0:56
toxcct16-Nov-05 0:56 
GeneralRe: Show and close dialog Pin
Steen Krogsgaard16-Nov-05 1:34
Steen Krogsgaard16-Nov-05 1:34 
AnswerRe: Show and close dialog Pin
Rage15-Nov-05 23:08
professionalRage15-Nov-05 23:08 
GeneralRe: Show and close dialog Pin
trunghd16-Nov-05 0:23
trunghd16-Nov-05 0:23 
GeneralRe: Show and close dialog Pin
Rage16-Nov-05 1:54
professionalRage16-Nov-05 1:54 
Questionneed help Pin
toufiq_raja15-Nov-05 20:42
toufiq_raja15-Nov-05 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.