Small doubt
-
Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)
-
Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)
As the MessageBox comes from CWnd and CDialog is a CWnd derived class but "independant" you can try
CDialog* pDlg = (CDialog*) GetActiveWindow ();
if (pDlg->IsKindOf(RUNTIME_CLASS(CDialog)))
//you have a dialog
else
//you have another thing, maybe a messagebox, maybe a view, maybe a windowAnother way to do the difference is the first member of both possibilites. By MessageBox the first member is a handler o a window
hWnd
, and in a DialogBox this handler is of the application instancehInstance
Hope it helpsGreetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)
-
Hi, Can any one tell me how to differentiate messagebox dialog from other dialogs. Thanks in advance.:)
kuttiam wrote:
Can any one tell me how to differentiate messagebox dialog from other dialogs.
MessageBox is type of dialog. but you don't need template to create it as it required by Dialog. plus a single api call i.e. MessageBox will create the message box for you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
As the MessageBox comes from CWnd and CDialog is a CWnd derived class but "independant" you can try
CDialog* pDlg = (CDialog*) GetActiveWindow ();
if (pDlg->IsKindOf(RUNTIME_CLASS(CDialog)))
//you have a dialog
else
//you have another thing, maybe a messagebox, maybe a view, maybe a windowAnother way to do the difference is the first member of both possibilites. By MessageBox the first member is a handler o a window
hWnd
, and in a DialogBox this handler is of the application instancehInstance
Hope it helpsGreetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)