介绍
偶为初学者,对主框架窗口,添加控件等操作感觉太不直观,搜索了众大侠的文章,综合了一下,弄了这个模板,主要为自己使用方便。
主要代码
#include <Windows.h>
#include <string>
#include "resource.h"
HINSTANCE hInst; // 当前实例
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HWND hWnd1;
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: 在此处放置代码。
// 执行应用程序初始化:
if (!InitInstance(hInstance, nCmdShow))
{
return FALSE;
}
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDD_DIALOG1));
MSG msg;
// 主消息循环:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (msg.hwnd == hWnd1) {
if (!IsDialogMessage(msg.hwnd, &msg))
{