为什么调用 DialogBox 会失败?
#include "stdafx.h"
#include "resource.h"
BOOL CALLBACK DialogProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if(LOWORD(wParam)==IDOK||LOWORD(wParam)==IDCANCEL)
EndDialog(hwndDlg,LOWORD(wParam));
return TRUE;
}
return false;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
if(DialogBox(hInstance,MAKEINTRESOURCE(IDD_CHAT_DIALOG),NULL,(DLGPROC)DialogProc)==-1)
{
MessageBox(NULL,"Call DialogBox failed.","Error",MB_ICONEXCLAMATION);
return -1;
}
return 0;
}
New->Win32 Application->A simple Win32 application->finish
然后 Insert->Recource 插入对话框,编译没有错误,可对话框就是不显示,请问这是为什么呢?但我改成 New->Win32 Application->A typicl "hello World" application->finish 就可以显示对话框,这是为什么呢?