📄 elevator.cpp
字号:
// ELEVATOR.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Elevator.h"
#include "MainDlg.h"
#include "Splash.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CElevatorApp
BEGIN_MESSAGE_MAP(CElevatorApp, CWinApp)
//{{AFX_MSG_MAP(CElevatorApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CElevatorApp construction
CElevatorApp::CElevatorApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
CElevatorApp::~CElevatorApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
//delete aBitMap;
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CElevatorApp object
CElevatorApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CElevatorApp initialization
BOOL CElevatorApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
//为显示启动画面做准备
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
//==========使用XP风格窗口
//if(this->OSVer()!="WinXP")
//{
typedef BOOL (WINAPI *pClassXP)(HWND,BOOL);
HINSTANCE hInst=NULL;
hInst=::LoadLibrary("ClassXP.dll");
if (hInst)
{
pClassXP pFunc= (pClassXP)GetProcAddress (hInst,"ClassXP");
pFunc(NULL,TRUE);
}
//}
CMainDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
//获取客户端OS版本
CString CElevatorApp::OSVer()
{
OSVERSIONINFOEX os;
::ZeroMemory(&os,sizeof(os));
os.dwOSVersionInfoSize=sizeof(os);
::GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&os));
if(os.dwPlatformId==VER_PLATFORM_WIN32_NT && os.dwMajorVersion >=5)
{
if(os.dwMinorVersion==0)
return "Win2000";
else
return "WinXP";
}
else if(os.dwPlatformId ==VER_PLATFORM_WIN32_WINDOWS)
return "Win9x";
else
return "unknown os";
}
//重载的函数,为定制的AfxMessageBox
int CElevatorApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
if (MB_USERDEFINE == nType)
{
RECT rect;
::GetClientRect(theApp.GetMainWnd()->m_hWnd,&rect);
int x = (rect.right - 340 + 1) / 2;
int y = (rect.bottom - 80 + 1) / 2;
CAboutDlg dlg;
dlg.Create(IDD_ABOUTBOX, NULL);
dlg.SetWindowText(lpszPrompt);
dlg.SetDlgItemText(IDC_STATIC_TEXT, lpszPrompt);
dlg.MoveWindow(x,y,340,120, true);
dlg.ShowWindow(SW_SHOW);
dlg.UpdateWindow();
Sleep(3000);
//dlg.ShowWindow(SW_HIDE);
dlg.DestroyWindow();
return TRUE;
}
return CWinApp::DoMessageBox(lpszPrompt, nType, nIDPrompt);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -