博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【Windows API】Button Control Functions
阅读量:4463 次
发布时间:2019-06-08

本文共 2345 字,大约阅读时间需要 7 分钟。

①CheckDlgButton

Changes the check state of a button control

②CheckRadioButton

Adds a check mark to (checks) a specified radio button in a group and removes a check mark from (clears) all other radio buttons in the group

③IsDlgButtonChecked

The IsDlgButtonChecked function determines whether a button control is checked or whether a three-state button control is checked, unchecked, or indeterminate 

#define _CRT_SECURE_NO_WARNINGS#include 
#include
#include "resource.h"int CDECL MessageBoxPrintf(TCHAR *szCaption, TCHAR *szFormat, ...){ TCHAR szBuffer[1024]; va_list pArgList; va_start(pArgList, szFormat); _vsntprintf(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList); va_end(pArgList); return MessageBox(NULL, szBuffer, szCaption, 0);}int CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case WM_INITDIALOG: return TRUE; case IDOK : CheckDlgButton(hwndDlg, IDC_CHECK1, BST_CHECKED); CheckRadioButton(hwndDlg, IDC_RADIO1, IDC_RADIO3, IDC_RADIO2); if (IsDlgButtonChecked(hwndDlg, IDC_RADIO2) == BST_CHECKED) MessageBox(NULL, TEXT(""), TEXT("确定"), 0); return TRUE; case IDNO : CheckDlgButton(hwndDlg, IDC_CHECK1, BST_UNCHECKED); CheckRadioButton(hwndDlg, IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); if (IsDlgButtonChecked(hwndDlg, IDC_RADIO2) == BST_CHECKED) MessageBox(NULL, TEXT(""), TEXT("取消"), 0); return TRUE; case IDCANCEL : EndDialog(hwndDlg, 0); PostQuitMessage(0); return TRUE; } } return FALSE;}int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ HWND hwnd; MSG message; hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc); if (hwnd == NULL) MessageBoxPrintf(TEXT(""), TEXT("%d"), GetLastError()); ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while (GetMessage(&message, NULL, 0, 0)) { TranslateMessage(&message); DispatchMessage(&message); } return message.wParam;}

 

转载于:https://www.cnblogs.com/Cxx-Code/p/3630550.html

你可能感兴趣的文章
java程序——凯撒加密
查看>>
面试题:比较两个数字大小
查看>>
Linux命令:pgrep
查看>>
大数据应用期末总评
查看>>
Windows Store App之数据存储
查看>>
实验五:Xen环境下多虚拟机的桥接配置
查看>>
抽象类和开闭原则
查看>>
English class 82 The Importance of traveling
查看>>
C++ 类与对象
查看>>
python用递归函数解汉诺塔游戏
查看>>
可持久化线段树入门小结
查看>>
Redis与Python交互
查看>>
VueJS参数绑定:v-bind:href,v-on:event
查看>>
Jmeter进行接口测试
查看>>
第一天python学习内容
查看>>
Maximum-SubsequenceSum
查看>>
常用的一些shell变量
查看>>
IOS省电
查看>>
Android无法删除项目+导入项目报错
查看>>
【python】获取网页中中文内容并分词
查看>>