Its wierd. It allows me to make the main window, but when I go and make static text (which is also a window of course) using the same class.. it compiles but on running the program it always returns my custom error.
Code:
BOOL WinProcedure::Create(DWORD argdwExStyle, LPCTSTR arglpClassName, LPCTSTR arglpWindowName, DWORD argdwStyle, int argx, int argy, int argnWidth, int argnHeight, HWND arghWndParent, HMENU arghMenu, HINSTANCE arghInstance, LPVOID arglpParam)
{
wHndl = CreateWindowEx(
argdwExStyle,
arglpClassName,
arglpWindowName,
argdwStyle,
argx,
argy,
argnWidth,
argnHeight,
arghWndParent,
arghMenu,
arghInstance,
arglpParam);
if(wHndl == NULL) {
ErrorDef->Exit("!(wHndl == NULL)", arglpWindowName, "window name"); // The error returned
return false;
} else {
return true;
}
}
Code:
WinProcedure *WinMainDef = new WinProcedure(); // Angel Child :)
WinProcedure *WinChildDef = new WinProcedure(); // Problem Child ;)
WinMainDef->Register(WndAppName, WndProcessor, CS_VREDRAW | CS_HREDRAW, hThisInstance, LoadIcon(NULL, IDI_APPLICATION), LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW), MAKEINTRESOURCE(IDM_MYMENURESOURCE), sizeof(WNDCLASSEX), LoadIcon(NULL, IDI_APPLICATION), 0, 0);
WinMainDef->Create(0, WndAppName, WndTitle, WS_SYSMENU | WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hThisInstance, NULL);
WinMainDef->Show(nFunsterStil); //WinMainDef is processed fine.
WinChildDef->Create(0,"static","Hello World!", WS_CHILD | SS_CENTER | WS_VISIBLE, 120, 130, 135, 28, WinChildDef->retWHndl(), NULL, hThisInstance, NULL); // WinChildDef is not processed. It is returning NULL.
I'ved tried blocking the WinMainDef code out (and the define of it) to see if its doing this because they share the same class. Nada, still get the error.
The error returns when Create returns NULL, but why would it have any reason to do that!
Help a guy out,