I just wrote this program, whats wrong? I get a lot of errors >.<

Code:
#include <windows.h>
const char classnamn[] = "myWinClass";

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam,
                        LPARAM lParam);

{
  switch(msg)
    {
        case WM_CLOSE:
        DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
        PostQuitMessage(0);
        break;
        default:
        return DefWindowProc(hwnd, msg, wParam, lParam);
    }
return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE
                    hPrevInstance, LPSTR lpCmdLine,
                     int nCmdShow)
{
    WNDCLASSEX b;
    HWND hwnd;
    MSG msg;
    
    b.cbSize = sizeof(WNDCLASSEX);
    b.style = 0;
    b.lpfnWndProc = WndProc;
    b.cbClsExtra = 0;
    b.cbWndExtra = 0;
    b.hInstance = hInstance;
    b.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    b.hCursor = LoadCursor(NULL, IDC_ARROW);
    b.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    b.lpszMenuName = NULL;
    b.lpszClassName = classnamn;
    b.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
    
    if(!RegisterClassEx(&b))
    {
        MessageBox(NULL, "Window Registration Failed!",
                        "Error!", MB_OK | MB_ICONERROR);
    return 0;
    }
    
    hwnd = CreateWindowEx(
            WS_EX_CLIENTEDGE,
            classnamn,
            "Title",
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
            NULL, NULL, hInstance, NULL);
    
    if(hwnd == NULL)
    {
        MessageBox(NULL, "Window Creation Failed!",
                        "Error", MB_OK | MB_ICONERROR);
        return 0;
    }
    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);
    
    while(GetMessage(&Msg), NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}