📄 messageorder.cpp
字号:
// MessageOrder.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "MainWnd.h"
// Global variables
CAppModule _Module;
HINSTANCE g_hInst = NULL ;
const TCHAR g_szApplicationTitle[] = _T("MessageOrder0.1");
const TCHAR g_szUniqueString[] = _T("oRkSjkXR/0qmxYKtXJQNnA==");
CString g_sAppName;
int LangID = 0 ;
int m_offset = 0 ;
// WinMain
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int CmdShow)
{
LANGID TempLangID = GetUserDefaultUILanguage() ; // GetSystemDefaultLangID() ;
switch ( TempLangID )
{
case 0x409 : LangID = 0 ; break ; // US English
case 0x804 : LangID = 1 ; break ; // P.R.C
case 0x404 : LangID = 2 ; break ; // TaiWan
default : LangID = 0 ; break ; // US English
}
m_offset = LangID * 1000 ;
// Check if one instance is already running.
const HANDLE hMutex = ::CreateMutex(NULL, FALSE, g_szUniqueString);
if(NULL != hMutex) {
if(ERROR_ALREADY_EXISTS == ::GetLastError())
{
// This is not the first instance of the application.
// Activate the firsty instance and exit.
const HWND hWndExistingInstance = ::FindWindow(g_szUniqueString, NULL);
VERIFY((NULL == hWndExistingInstance) || ::SetForegroundWindow(hWndExistingInstance));
return 0;
}
// Init common controls
// TODO: remove unused controls
INITCOMMONCONTROLSEX comctrex;
comctrex.dwSize = sizeof(comctrex);
comctrex.dwICC = ICC_UPDOWN_CLASS
| ICC_DATE_CLASSES // date and time-picker control
| ICC_PROGRESS_CLASS // progress bar control
| ICC_LISTVIEW_CLASSES // list view and header control
| ICC_TREEVIEW_CLASSES; // tree view control
::InitCommonControlsEx(&comctrex);
// Init module.
_Module.Init(NULL, hInstance);
g_hInst = hInstance ;
// Create main window.
g_sAppName.LoadString(IDS_APPNAME+m_offset);
CMainWnd wnd;
RECT rc;
::SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
if(NULL == wnd.Create(NULL, rc, g_szApplicationTitle, WS_VISIBLE))
{
return 1;
}
// Run message loop.
CMessageLoop loop;
_Module.AddMessageLoop(&loop);
int nResult = loop.Run();
// Terminate.
_Module.RemoveMessageLoop();
_Module.Term();
return nResult;
}
return 2;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -