#include
#include
#include "resource.h"
HWND dhwnd;
BOOL CALLBACK dlgp(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
int WINAPI _tWinMain(HINSTANCE hinstance,HINSTANCE,LPTSTR lp,int cmd)
{
dhwnd=CreateDialog(0,LPTSTR(IDD_DIALOG1),0,dlgp);
ShowWindow(dhwnd,1);
MSG msg;
ZeroMemory(&msg,sizeof(MSG));
while(msg.message!=WM_QUIT)
{ Sleep(2);
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
}
}
return 0;
}
BOOL CALLBACK dlgp(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
break;
case WM_CLOSE:
exit(0);
break;
/*case WM_COMMAND:
switch(LOWORD(wparam))
{case IDC_BUTTON1:
EndDialog(hwnd,0);
break;
}
break;*/
}
return FALSE;
}
//WinSDK的 IDD_DIALOG1 是你的对话框ID
建立MFC时,在选项中有一个dialog选项,选那个就行了