Advertisement

Win32 Programming

Started by December 25, 2000 09:51 PM
1 comment, last by ziplux 24 years, 1 month ago
I''m making a small Win32 utility app in Visual C++, and I''ve used the resource editor to make a dialog box. I want the dialog box to be my main window, instead of me creating it manually in code. Right now, I''m using the CreateDialog function like this:

g_hwnd = CreateDialog(g_hinst, (LPCTSTR)IDD_MAINWND, NULL, (DLGPROC)MainWnd); 
That works fine except that when I try to hit tab in my dialog or hit enter to invoke the default button, it makes the system beep noise and does nothing. However, if I create it with the DialogBox function, like this:

DialogBox(g_hinst, (LPCTSTR)IDD_MAINWND, NULL, (DLGPROC)MainWnd); 
tabbing works fine, but I don''t get a HWND handle to the window. Another interesting thing I found is that both of these functions use CreateWindowEx through a macro, so I''m also wondering how to use CreateWindowEx to create a window from a dialog resource. Thanks in advance! My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t X R- tv+ b++ DI+(+++) D- G e* h!" Decode my geekcode! Geekcode.com
Visit our web site: Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
You can insert a IsDialogMessage() function into your message-loop to pass messages to your dialogbox created with CreateDialog(). I recall something "difficult" about destroying that window (I must get some sleep), but if you lookup IsDialogMessage() I think you will find it.

Advertisement
Thanks so much! I looked up that function and it is exactly what I needed. Thanks again!


My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t X
R- tv+ b++ DI+(+++) D- G e* h!"
Decode my geekcode!
Geekcode.com


Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment

This topic is closed to new replies.

Advertisement