Jump to content

WinApi Error

- - - - -

  • Please log in to reply
No replies to this topic

#1
robbiewoods05

robbiewoods05

    Newbie

  • Members
  • PipPipPip
  • 40 posts
  • Learning:C++, C#, Haskell
I'm trying to make a window. Here's my code:

#include <windows.h>




int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCMdShow)

{

    MSG msg;

    WNDCLASS wc = {0};

        wc.lpszClassName = TEXT("My Window");

        wc.hInstance = hInstance;

        wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);

        wc.lpfnWndProc = WNDPROC;

        wc.hCursor = LoadCursor(0, IDC_ARROW);

    RegisterClass(&wc);

    CreateWindow(wc.lpszClassName, TEXT("Our First Window!"), WS_VISIBLE|WS_OVERLAPPEDWINDOW, 100, 100, 500, 500, hInstance, 0);

    while(GetMessage(&msg, NULL, 0, 0)) {

        TranslateMessage(&msg);

        DispatchMessage(&msg);

    }

    return (int) msg.wPARAM;

    switch(msg)

  {

    case WM_CREATE:

    {

        break;

    }

    case WM_COMMAND:

        {}

        break;

    case WM_DESTROY:

    PostQuitMessage(0);

    return 0;

    }

    return DefWindowProc(hwnd, msg, wParam, lParam);

}


But I get a few errors. These are:Attached File  Capture.PNG   24.82K   26 downloads

I followed a tutorial in the tutorials section.
i pretty much copied the code exactly

Where have i gone wrong?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users