Jump to content
  • Advertisement
Sign in to follow this  

Create Window Error - Solved

This topic is 4772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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 [ ]. :)

Share this post


Link to post
Share on other sites


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);


Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!