Create Window Error - Solved
What would cause CreateWindowEx to return The system cannot find the file specified, I've been working on it for awhile and I'm lost. Thanks a lot for your help.
[Edited by - clrscr on April 26, 2005 10:01:06 PM]
HWND CreateWindowEx( DWORD dwExstyle, // extended window style LPCTSTR lpClassName, // registered class name LPCTSTR lpWindowName, // window name DWORD dwstyle, // window style int x, // horizontal position of window int y, // vertical position of window int nWidth, // window width int nHeight, // window height HWND hWndParent, // handle to parent or owner window HMENU hMenu, // menu handle or child identifier HINSTANCE hInstance, // handle to application instance LPVOID lpParam // window-creation data);
As a guess, one of the arguments to the function is probably wrong. Quite likely the hMenu argument, but maybe the hInstance argument. You'll have to provide more information - such as a snippet of the code that calls CreateWindowEx. For best results, put the code snippet inside <source> </source> blocks - don't forget to replace the angle brackets with square ones [ ]. :)
DWORD style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; DWORD exstyle = WS_OVERLAPPEDWINDOW;CreateWindowEx(exstyle, "MIP","MIPS", WS_CLIPSIBLINGS |WS_CLIPCHILDREN|style, 0,0, wr.right-wr.left, wr.bottom-wr.top, NULL, NULL, hInstance, NULL);
That code looks ok to me. The error may not have anything to do with CreateWindowEx, even though the debugger suggests it. There might be code in the WM_CREATE handler case of the WndProc that is causing the error which is then bubbling up to appear as if the problem is with CreateWindowEx. CreateWindowEx also sends WM_NCCREATE and WM_NCCALCSIZE messages. If you have handlers for those messages, the problem could be in those handlers too. I'm guessing you might have some file opening code in the WM_CREATE handler.
So I tracked the error down to being an Invaild Pixel Format which only occurs when I run my program in Windowed mode
Thanks again for all your help
int npf; static PIXELFORMATDESCRIPTOR pfd = { sizeof(pfd), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0,0,0,0,0,0, 0, 0, 0, 0,0,0,0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0,0,0 }; npf = ChoosePixelFormat( ghDC, &pfd); if(!npf) { GetSystemError(); } if(!SetPixelFormat(ghDC,npf,&pfd)) { GetSystemError(); }
Thanks again for all your help
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement