none
CreateWindowEx

    Question

  • CreateWindowEx(NULL,
    "WindowClass",
    "Sternenfeld",
    WS_OVERLAPPEDWINDOW |
    WS_VISIBLE |
    WS_POPUP,
    100, 100, SCREEN_X_SIZE, SCREEN_Y_SIZE,
    NULL,
    NULL,
    hInstance,
    NULL);

    Fails with code 0xc0000005 at runtime

    hInstance is a Var of Type HINSTANCE
    SCREEN_X_SIZE, SCREEN_Y_SIZE are int - MAKROS

    VC6 compile works without errors but VC Express 2005 doesn't

    no MFC or similar is used.

    Anything to try?

    edit: I can post the disassemblcode if this helps
    Saturday, October 21, 2006 1:39 PM

Answers

  • Hi Christoph,

    0xc0000005 is an access violation. I assume you have registeres a window class "WindowClass" which specifies which wndproc to call. I would assume that the error is in your wndproc.

    --
    SvenC

    Saturday, October 21, 2006 5:58 PM

All replies

  • Hi Christoph,

    0xc0000005 is an access violation. I assume you have registeres a window class "WindowClass" which specifies which wndproc to call. I would assume that the error is in your wndproc.

    --
    SvenC

    Saturday, October 21, 2006 5:58 PM
  • I'll post the relevant code perhapes you can find the problem

    WNDCLASSEX wndClass =
        {
            sizeof(WNDCLASSEX),                                
            CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW,          
            MessageHandler,                                   
            0,                                                 
            0,                                                 
            hInstance,                                       
            LoadIcon(NULL, IDI_WINLOGO),                     
            LoadCursor(NULL, IDC_ARROW),                       
            (HBRUSH)GetStockObject(BLACK_BRUSH),            
            NULL,                                          
            "WindowClass",                                    
            LoadIcon(NULL, IDI_WINLOGO)                   
        };


    LRESULT CALLBACK MessageHandler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
    {
        switch(msg)
        {
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
            break;
        case WM_PAINT:
            Direct3D.BeginScene();
            Direct3D.EndScene();
            break;
        case WM_MOUSEMOVE:
            g_MouseX = LOWORD(lparam);
            g_MouseY = HIWORD(lparam);
            break;
        case WM_LBUTTONDOWN:
            g_MouseDown = true;
            break;
        case WM_LBUTTONUP:
            g_MouseDown = false;
            break;
        case WM_KEYDOWN:
            switch(wparam)
            {
            case VK_ESCAPE:
                if(g_IsPlaying == true && g_CurGameState == GAMESTATE_MENU)
                {
                    GameTimer.reset();
                    g_CurGameState = GAMESTATE_PLAY;
                }
                else
                {
                    Menu.SetSubMenu(MENU_SUB_START);
                    g_CurGameState = GAMESTATE_MENU;
                }
                break;
            }
            break;
        }

        return (DefWindowProc(hwnd, msg, wparam, lparam));
    }
    Saturday, October 21, 2006 6:43 PM
  • Followed The error to some DirectX9 Function.
    I'll try to find the mistake there
    thanks for your answer
    Saturday, October 21, 2006 7:59 PM