main.cpp

来自「c+++ game uploading now」· C++ 代码 · 共 57 行

CPP
57 行
字号
/**
 @file
 The WinMain() function.
*/

#include <exception>
#include <windows.h>
#include "lib/WinException.h"
#include "lib/MessageLoop.h"
#include "lib/Accelerator.h"
#include "lib/MessageBox.h"
#include "NewHandler.h"
#include "TopWindow.h"
#include "resource.h"

using namespace Win;


/** application instance */
HINSTANCE TheInstance=0;


int WINAPI WinMain
   (HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
{
    try
    {
        //initialize application instance
        TheInstance=hInst;
        
        //register new out of memory handler, throwing Win::Exception
        OutOfMemory::RegisterNewHandler();

        //create main "window||dialog"
        TopWindow topWindow(hInst);
    
        //load the accelerator table
        Accelerator accel(hInst, MAKEINTRESOURCE(IDR_ACCELERATOR1));

        //our message loop, uses keyboard accelerators
        MessageLoop msgloop(topWindow, accel);

        //now run the message loop
        return msgloop.Run();
    }
    catch(Win::Exception &e)
    {
        e.Show();
    }
    catch(...)
    {
        Win::MessageBox(0, "Unknown Exception", "Shylock",
                        MB_ICONEXCLAMATION|MB_OK);
    }
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?