1.windows 应用程序开发(MessageBox 和 DialogBox 和 WM_COMMAND)

来源:互联网 发布:聚焦网络爬虫 软件 编辑:程序博客网 时间:2024/06/05 16:35

#include #include "resource.h"// HINSTANCE 一个实例的句柄INT_PTR CALLBACK theProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){// 这是一个回调函数,等待点击后的处理switch (uMsg){case WM_COMMAND:if (LOWORD(wParam) == IDCANCEL){EndDialog(hwndDlg,IDCANCEL);}else if (LOWORD(wParam) == IDOK){int left = GetDlgItemInt(hwndDlg, IDC_LEFT, NULL, TRUE);int right = GetDlgItemInt(hwndDlg, IDC_RIGHT, NULL, TRUE);SetDlgItemInt(hwndDlg, IDC_RESULT, left + right, TRUE);}break;}return 0;}int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR lpCmdLine, int nShowCmd){DialogBox(hInstance,(LPCTSTR)IDD_MAIN_DLG,NULL,theProc);MessageBox(NULL,L"这里是对话框中显示的内容",L"这是对话框的标题",0);return 0;}



阅读全文
0 0
原创粉丝点击