I am porting a 16-bit DLL to the 32-bit world. The exe which uses this DLL is also being ported. In the DLL there is a function which calls CreateDialog to create a modeless dialog box. The code in the 16 bit world looked like this :
Begin DLL exported function ()
hwnd = NULL;
if (hwnd == NULL)
hwnd = CreateDialog (hinst, MAKEINTRESOURCE (cancel_dialog),
_itoa( TaskInfo.hTask,buffer,8 );
SetDlgItemText(hwnd, Task_ID, buffer);
_itoa( (int) CallArg.thread_handle,buffer,8 );
SetDlgItemText(hwnd, Thread_ID, buffer);
SetWindowLong (hwnd, DWL_USER, (LONG) &CallArg);
EndDialog (hwnd, 0);
} // end of DLL exported fn.
In the 32 bit world I have changed the 3rd parameter to hParent which is passed from the EXE as the EXE's hWnd.
When I run this in my Win NT 4.0 Workstation the CreateDialog procedure does not create any dialog box on the screen. According to docs, when CreateDialog fails it returns hwnd as NULL and you should be able to see GetLastError to find out which error has occured.
However, though hwnd is returned as NULL, there does'nt seem to be any error set as GetLastError returns 0 !! I've racked my brains out for hours on this - any suggestions ?