#include <Windows.h> #include "resource.h" INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) { BOOL bRet = TRUE; switch(uMsg) { case WM_CLOSE: EndDialog(hDlg,0); break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_BUTTON1: MessageBox(hDlg,"Hello Button 1","Demo",MB_OK); break; case IDC_BUTTON2: MessageBox(hDlg,"Hello Button 2","Demo",MB_OK); break; default: bRet = FALSE; break; } break; case WM_LBUTTONDOWN: MessageBox(hDlg,"Helle窗口!","Demo",MB_OK); default: bRet = FALSE; break; } return bRet; } int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDMAIN),NULL, MainDlgProc); }
时间: 2024-11-07 14:20:06