Sign in to follow this  
3dmaniac

CreateWindowEx allways returns 0 SOLVED

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
  • 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

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    Sign in to follow this