我写了这个了 default:
return DefWindowProc(hWnd,message,wParam,lParam);
下面是全部代码
#include<windows.h>
#include"resource.h"
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd )
{
MSG msg;
DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,(DLGPROC)WndProc,NULL);
while(GetMessage(&msg,(HWND)NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
MessageBox(hWnd,TEXT("OK"),TEXT("OK"),NULL);
break;
}
break;
default:return DefWindowProc(hWnd,message,wParam,lParam);
}
return FALSE;
}
{
switch(message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
MessageBox(hWnd,TEXT("OK"),TEXT("OK"),NULL);
break;
}
break;
case WM_CLOSE: //新增关闭消息
PostQuitMessage(0);
break;
//default:return DefWindowProc(hWnd,message,wParam,lParam); 删除
}
return FALSE;
}