View Full Version : CreateWindowEx inside a DLL

21-06-2005, 08:18 PM
Hi All

I'm trying to create a window using CreateWindowEx inside a DLL
but for no apparent reason the h_Instance := GetModuleHandle(nil);
seems to succeed, but then gives me an error code when I call GetLastError();

For the first time in my life google was absolutely useless :cry:

I have created a test application to show the error.

testdll.zip (http://www.sulaco.co.za/testcode/testdll.zip)

Any Help would be greatly appreciated. :lol:

Use TestExe.exe as the testbed for the Dll while debugging

21-06-2005, 09:58 PM
From a quick test, it seems that GetLastError reports an error even before GetModuleHandle, and CreateWindowEx seems to work with widows classes like Static, looks like it has a problem with youre custom window class

22-06-2005, 10:38 AM
Ok took another look and the problem narrowed down to WndProc, when instead of you're WindProc DefWindowProc is used it works