Jump to content
  • Advertisement
Sign in to follow this  
3dmaniac

CreateWindowEx allways returns 0 SOLVED

This topic is 3932 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

Works perfect in VC6 but hell not in vc2005...i've got no idea whats' going on edit. WNDCLASS wc; h_Instance = GetModuleHandle(NULL); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = h_Instance; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.lpszClassName = L"Window"; // THIS if (!RegisterClass(&wc)) { return false; } dwExstyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; dwstyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; h_Wnd = CreateWindowEx( dwExstyle, L"SomeWindow", // and THIS should be the same L"Some title", dwstyle, 0, 0, 640, 480, 0, 0, h_Instance, NULL ); Thanks people, i used GetLastError and i got error 1407 (cant find window class), class names were different. Thanks a lot. [Edited by - 3dmaniac on October 12, 2007 8:53:41 AM]

Share this post


Link to post
Share on other sites
Advertisement
  • You can use GetLastError() to get an error code if CreateWindowEx() fails.
  • Put a breakpoint in your window proc and see if it's being called at all. If it is, then it's almost certainly a problem with you window proc. If it's not, then it's CreateWindowEx().
  • Related to the above, are you sure you're handling WM_CREATE properly?

    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.

    We are the game development community.

    Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

    Sign me up!