⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winapp.cpp

📁 使非MFC窗口程序的窗口回调过程成为C++类的成员函数。
💻 CPP
字号:
#include "stdafx.h"
#include "winapp.h"
#include "dialog.h"
#include "formdlg.h"


CWinApp		g_theApp;


int APIENTRY _tWinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPTSTR lpCmdLine,
	int nShowCmd)
{
	g_hInstance = hInstance;
	g_theApp.m_hInst = hInstance;
	if(g_theApp.InitInstance())
	{
		return g_theApp.Run();
	}
	return g_theApp.ExitInstance();
}


CWinApp::CWinApp() : m_hInst(NULL), m_nRetCode(0)
{
}


CWinApp::~CWinApp()
{
}


bool CWinApp::InitInstance()
{
	CFormDlg	dlg;
	dlg.DoModal();
	return false;
}


int CWinApp::Run()
{
	MSG		msg;

	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	m_nRetCode = msg.wParam;
	return ExitInstance();
}


int CWinApp::ExitInstance()
{
	return m_nRetCode;
}

⌨️ 快捷键说明

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