-
December 8th, 2005, 01:37 AM
#1
CreateDialog Failed, but GetLastError return 0
I want to create a modeless dialog in WinXP using .net 2003
code:
///////////////////////////////////////////////////////////////////////////
HWND hwnd;
hwnd = CreateDialog( ::g_hInstance, MAKEINTRESOURCE( IDD_CONTROL_PANEL ), NULL, ControlPanelProc );
if( NULL == hwnd ){
DWORD dwerr = GetLastError();
}
///////////////////////////////////////////////////////////////////////////////
when running the program, hwnd is NULL, and dwerr == 0 ( no error! ).
the same code segment works in another program
how to solve the problem, thanks for any help and advice.
-
December 8th, 2005, 03:01 AM
#2
Re: CreateDialog Failed, but GetLastError return 0
Originally Posted by FatGarfield
I want to create a modeless dialog in WinXP using .net 2003
code:
///////////////////////////////////////////////////////////////////////////
HWND hwnd;
hwnd = CreateDialog( ::g_hInstance, MAKEINTRESOURCE( IDD_CONTROL_PANEL ), NULL, ControlPanelProc );
if( NULL == hwnd ){
DWORD dwerr = GetLastError();
}
///////////////////////////////////////////////////////////////////////////////
when running the program, hwnd is NULL, and dwerr == 0 ( no error! ).
the same code segment works in another program
how to solve the problem, thanks for any help and advice.
are you sure that in the resource file there is IDD_CONTROL_PANEL template dialog? and its not just declared in resource.h ?
Cheers
-
December 8th, 2005, 03:07 AM
#3
Re: CreateDialog Failed, but GetLastError return 0
I found where the error comes from. If you forgot to link comctl32.lib, but in the dialog template List control or Tree control exists, you'll get NULL window handle, but with error code 0.
thank you
golanshahar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|