![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |||
|
Newbie
Join Date: Apr 2005
Posts: 6
Rep Power: 0
![]() |
Hi all
I have been following a tutorial on creating win32 GUI applications. I'm having a problem getting a dialog box to pop up on top of my main window ...the CreateDialog() method returns a NULL for some reason. Would really appreciate some help with this. The source code -- http://www.apcx.3rror.com/main.cpp (the program runs, but the test condition for CreateDialog()'s return value shows a NULL value is returned) The resource file: Quote:
Window Procedure of the main window... Quote:
Message Handling function of the dialog box... Quote:
Last edited by apcx; Feb 24th, 2006 at 12:30 PM. |
|||
|
|
|
|
|
#2 |
|
Hobbyist
Join Date: Sep 2005
Posts: 261
Rep Power: 4
![]() |
Well for a start: I doubt that 'IDD_TOOLBAR' is defined in 'windows.h'.
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Apr 2005
Posts: 6
Rep Power: 0
![]() |
I've defined it in main.cpp:
#define IDD_TOOLBAR 9004 Now I've tried defining it in the resource file as well, but CreateDialogBox() still returns a NULL ... |
|
|
|
|
|
#4 |
|
Hobbyist
Join Date: Sep 2005
Posts: 261
Rep Power: 4
![]() |
Place all your resource ID definitions in a single header file, and include that as needed. Also, try cast the parameter 'lpDialogFunc' of 'CreateDialog' to 'DLGPROC' like so:
hDialog = CreateDialog( GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_TOOLBAR), hwnd, reinterpret_cast<DLGPROC>(ToolDlgProc) ); |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|