int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
    static char szAppName[] = "MyApp";
    static char szWndClass[] = "MyWindowClass";
    static char szAtomName[] = "<MyApp>; Amy's birthday is 05-07-93 <MyApp>";

    WNDCLASS wc;
    HWND hwnd;
    MSG msg;
    ATOM atom;

    // Check the global atom table for an instance of
    // szAtomName. If the atom exists, there must be
    // another instance of this application running.
    
    if (GlobalFindAtom (szAtomName))
    {
        MessageBox (NULL, "Another instance of this application is running", "Error", MB_OK |
                    MB_ICONSTOP);
        return -1;
    }

    // No previous instance was detected; add szAtomName
    // to the table.
    atom = GlobalAddAtom (szAtomName);
    
    wc.style = 0;
    wc.lpfnWndProc = (WNDPROC) WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = szWndClass;
    RegisterClass (&wc);

    hwnd = CreateWindow (szWndClass, szAppName,
            WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
            CW_USEDEFAULT, HWND_DESKTOP, NULL, hInstance, NULL);
    
    ShowWindow (hwnd, nCmdShow);
    UpdateWindow (hwnd);
    
    while (GetMessage (&msg, NULL, 0, 0))
    {
        TranslateMessage (&msg);
        DispatchMessage (&msg);
    }

    // Delete the atom before exiting.
    GlobalDeleteAtom (atom);
    
    return msg.wParam;
}