Click here to Skip to main content
16,004,991 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MACROS. Pin
Christian Graus2-Dec-03 17:33
protectorChristian Graus2-Dec-03 17:33 
GeneralRe: MACROS. Pin
WREY2-Dec-03 18:10
WREY2-Dec-03 18:10 
GeneralRe: MACROS. Pin
Christian Graus3-Dec-03 8:36
protectorChristian Graus3-Dec-03 8:36 
GeneralRe: MACROS. Pin
Bob Stanneveld2-Dec-03 21:09
Bob Stanneveld2-Dec-03 21:09 
GeneralRe: MACROS. Pin
WREY3-Dec-03 6:53
WREY3-Dec-03 6:53 
Questioncan wmi-client access the remote wmi on a machine outside of lan network? Pin
Habbit2-Dec-03 13:21
Habbit2-Dec-03 13:21 
GeneralFile Dialog after dialog creation Pin
act_x2-Dec-03 10:28
act_x2-Dec-03 10:28 
GeneralRe: File Dialog after dialog creation Pin
GeMe_Hendrix2-Dec-03 11:11
GeMe_Hendrix2-Dec-03 11:11 
Well there's a few ways to tackle this problem. Indeed you could use a timer. But the most important thing for you to understand is how message queues in Windows work. However, first the answer to your question. Try creating your own custom message ad handler for it first therefore at the top of your dialog CPP file...

#define WM_MYOWNMESSAGE WM_USER + 1001;

... Then in the header file put...

afx_msg LRESULT OnMyOwnMessage(WPARAM wParam, LPARAM lParam);

...Then the appropriate body for it...

LRESULT CMyDialog::OnMyOwnMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
   ... Show the file dialog box (I know it has to be modal)<br />
   return 0;<br />
};


... And finally in the body put...

ON_MESSAGE(WM_MYOWNMESSAGE, OnMyOwnMessage)

... in the BEGIN_MESSAGE_MAP section...

... To call the message handler put this in the OnInitDialog function just before it returns...

PostMessage(WM_MYOWNMESSAGE, 0, 0);

So okay, this should work. But why should this work? You could do the same thing with a timer (Its another message WM_TIMER). Well as you well know OnInitDialog gets called when all the handles for all the windows you are creating are created but not shown. We post a custom message on to the message queue of the dialog box. This eventually gets processed. As I'm placing it on the message queue in OnInitDialog it will only get processed after this point in which the dialog box will be shown. I'm sure there are other ways but I find this one works very well for me :!)
GeneralGetProcAddress problem... Pin
LukeV2-Dec-03 10:19
LukeV2-Dec-03 10:19 
GeneralRe: GetProcAddress problem... Pin
LukeV2-Dec-03 10:30
LukeV2-Dec-03 10:30 
GeneralRe: GetProcAddress problem... Pin
Tim Smith2-Dec-03 15:35
Tim Smith2-Dec-03 15:35 
QuestionSize of a CDHTMLDialog? Pin
Robert Mooney2-Dec-03 7:41
Robert Mooney2-Dec-03 7:41 
AnswerRe: Size of a CDHTMLDialog? Pin
Peter Molnar2-Dec-03 14:21
Peter Molnar2-Dec-03 14:21 
GeneralRe: Size of a CDHTMLDialog? Pin
Robert Mooney6-Dec-03 16:15
Robert Mooney6-Dec-03 16:15 
GeneralRe: Size of a CDHTMLDialog? Pin
Peter Molnar7-Dec-03 3:01
Peter Molnar7-Dec-03 3:01 
GeneralRe: Size of a CDHTMLDialog? Pin
Robert Mooney9-Dec-03 5:55
Robert Mooney9-Dec-03 5:55 
GeneralRe: Size of a CDHTMLDialog? Pin
Peter Molnar9-Dec-03 10:38
Peter Molnar9-Dec-03 10:38 
AnswerRe: Size of a CDHTMLDialog? Pin
Maciej Jaros7-Dec-12 7:21
Maciej Jaros7-Dec-12 7:21 
GeneralDraw an Icon Pin
Hadi Dayvary2-Dec-03 6:52
professionalHadi Dayvary2-Dec-03 6:52 
GeneralRe: Draw an Icon Pin
David Crow2-Dec-03 9:40
David Crow2-Dec-03 9:40 
GeneralRe: Draw an Icon Pin
Monty22-Dec-03 19:15
Monty22-Dec-03 19:15 
GeneralKeyboard event in Dialog Box Pin
Member 3322372-Dec-03 6:32
Member 3322372-Dec-03 6:32 
GeneralRe: Keyboard event in Dialog Box Pin
GeMe_Hendrix2-Dec-03 11:18
GeMe_Hendrix2-Dec-03 11:18 
GeneralPlot graph Pin
Best Friend2-Dec-03 6:20
Best Friend2-Dec-03 6:20 
GeneralRe: Plot graph Pin
Member 3322372-Dec-03 7:58
Member 3322372-Dec-03 7:58 

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.