如何在Win32中的按钮中读取Riadio按钮值 [英] How To Read Riadio Buttons Value In buttons in Win32

查看:70
本文介绍了如何在Win32中的按钮中读取Riadio按钮值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有Win32脚本,其中包含一些按钮&单选按钮。 for Buttons我正在使用SetWindowLong(hDlg1,GWL_USERDATA,10)函数。

我想知道如何读取单选按钮值并在按钮中使用?

例如:



Hi,
I have Win32 script that include some buttons & Radio buttons. for Buttons I am using SetWindowLong(hDlg1, GWL_USERDATA, 10) function.
I want know how can read radio buttons value and use in button?
For example:

<pre lang="c++">case IDC_BTN_SELLSTOP:   // Button
			hDlg1 = GetParent(hDlg);
			SetWindowLong(hDlg1, GWL_USERDATA, 2); 
			
			break;





case IDC_BTN_B_DRAW: //单选按钮

hDlg1 = GetParent(hDlg);

SetWindowLong(hDlg1,GWL_USERDATA,10);

休息;





是否可以在IDC_BTN_SELLSTOP中读取IDC_BTN_B_DRAW值?

例如同样的:



case IDC_BTN_B_DRAW: //Radio Button
hDlg1 = GetParent(hDlg);
SetWindowLong(hDlg1, GWL_USERDATA, 10);
break;


Is it possible read IDC_BTN_B_DRAW value in IDC_BTN_SELLSTOP?
For example same this:

case IDC_BTN_SELLSTOP:   // Button
			hDlg1 = GetParent(hDlg);
			SetWindowLong(hDlg1, GWL_USERDATA, GetWindowLong(hWnd, GWL_USERDATA)); 
			
			break;





问候;



Regards;

推荐答案

单选按钮的值是可能的状态值之一: BST_CHECKED BST_INDETERMINATE BST_UNCHECKED ,通过向此控件发送消息 BM_GETCHECK 进行测试:

http://msdn.microsoft.com/ en-us / library / bb775986%28VS.85%29.aspx [ ^ ]。



-SA
The "value" of a radio button is one of the possible status values: BST_CHECKED, BST_INDETERMINATE or BST_UNCHECKED, tested by sending a message BM_GETCHECK to this control:
http://msdn.microsoft.com/en-us/library/bb775986%28VS.85%29.aspx[^].

—SA


这篇关于如何在Win32中的按钮中读取Riadio按钮值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆