Create Window Error - Solved

Started by
5 comments, last by clrscr 18 years, 12 months ago
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]
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
Advertisement
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 [ ]. :)
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
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);
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
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.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
is it possible because the window class is not registered??
So I tracked the error down to being an Invaild Pixel Format which only occurs when I run my program in Windowed mode

	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
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
bump :(
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)

This topic is closed to new replies.

Advertisement