CreateDialogue win32的基本框架问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 19:57:52
求一个最基本的CreateDialogue框架程序(只创建一个Dialog窗口就行)
要求能编译运行的完整程序

int WINAPI WinMain(...)
{
CreateDialog();
return 0;
}

#include "stdafx.h"
#include "resource.h"

HINSTANCE hInst;

LRESULT MainDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hDlg = NULL;

hInst = hInstance;

hDlg = CreateDialog(hInstance, (LPCTSTR)IDD_DIALOG1, 0,(DLGPROC)CallMainDlgProc);

ShowWindow(hMainDlg, nCmdShow);

while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

LRESULT MainDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CLOSE:
DestroyWindow(hDlg);
return TRUE;<