is this created automatically by the DialogBox macro? is it possible to access the MSG structs for a dialog inside its dialog procedure (the ones that would be passed to TranslateMessage and such functions)?
is this created automatically by the DialogBox macro? is it possible to access the MSG structs for a dialog inside its dialog procedure (the ones that would be passed to TranslateMessage and such functions)?
In Win32 API, you can call IsDialogMessage() to check the message destination. In MFC, check out PreTranslateMessage().
Kuphryn
Yes. If you want to run your own message loop use CreateDialog() to create a modeless dialog. Remember the IsDialogMessage() call as mentioned by Kuphryn.is this created automatically by the DialogBox macro?
Not if you use DialogBox().is it possible to access the MSG structs for a dialog inside its dialog procedure (the ones that would be passed to TranslateMessage and such functions)?
yea, but both of these need the MSG struct, which is what i was asking for.Originally Posted by kuphryn
is it ok to return the result of CreateDialog in WinMain?
>>is it possible to access the MSG structs<<
Indirectly you can get the information. ConsiderThe hwnd, wParam, lParam and message are all available within your dialog procedure. For time there's GetMessageTime and for pt there's GetMessagePos.Code:typedef struct { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG;
>>is it ok to return the result of CreateDialog in WinMain<<
From msdn description of WinMain
edit: copyright notice included in msdn quote in accordance with 10% rule.Return Value
If the function succeeds, terminating when it receives a WM_QUIT message, it should return the exit value contained in that message's wParam parameter. If the function terminates before entering the message loop, it should return zero.
©2004 Microsoft Corporation. All rights reserved.
Last edited by Ken Fitlike; 06-03-2004 at 12:14 PM.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.