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.
Re: CreateDialog Failed, but GetLastError return 0
Quote:
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
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