找回密码
 加入
搜索
查看: 1864|回复: 2

[AU3基础] 关于dllcall调用CheckRadioButton问题[已解决]

[复制链接]
发表于 2011-7-18 17:31:57 | 显示全部楼层 |阅读模式
本帖最后由 502762378 于 2011-7-18 18:52 编辑

先上CheckRadioButton的说明
 函数功能:该函数给一组单选按钮中的一个指定按钮加上选中标志,并且清除组中其他按钮的选中标志。

    函数原型:BOOL CheckRadioButton(HWNDhDlg, intnlDFirstButton, intnlDLastBUtton, intnlDCheckButton);

    参数:

    hDlg:指向包含单选按钮的对话框的句柄。

    nlDFirstButton:指定组中第1个单选按钮的标识符。

    nlDLastButton:指定组中最后一个单选按钮的标识符。

    nlDCheckButton:指出要选中的那个单选按钮的标识符。

    返回值:如果函数执行成功,返回值非零;如果失败,则返回零。若想获取更多错误信息,请调用GetLastError函数。
按照说明,创建几个Radio,调用此函数是不是可以达到清除所有的选中的Radio,选中单个所要的Radio。其实是有一个疑问的,组中第一个和最后一个,我人为性的写成1和3,测试却不成功,请求各位帮忙,谢谢
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 227, 159, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 16, 56, 129, 49)
$Radio1 = GUICtrlCreateRadio("Radio1", 160, 16, 57, 41)
$Radio2 = GUICtrlCreateRadio("Radio1", 160, 64, 65, 33)
GUICtrlSetState($radio2, $GUI_CHECKED)
$Radio3 = GUICtrlCreateRadio("Radio1", 160, 112, 65, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        DllCall("user32.dll","Int","CheckRadioButtonA","hwnd",$Form1,"Int",$Radio1,"Int",$Radio3,"Int",$Radio1)
        EndSwitch
WEnd
发表于 2011-7-18 18:16:12 | 显示全部楼层
#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 227, 159, 192, 124)

$Button1 = GUICtrlCreateButton("Button1", 16, 56, 129, 49)

$Radio1 = GUICtrlCreateRadio("Radio1", 160, 16, 57, 41)

$Radio2 = GUICtrlCreateRadio("Radio1", 160, 64, 65, 33)

GUICtrlSetState($radio2, $GUI_CHECKED)

$Radio3 = GUICtrlCreateRadio("Radio1", 160, 112, 65, 33)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###



While 1

        $nMsg = GUIGetMsg()

        Switch $nMsg

                Case $GUI_EVENT_CLOSE

                        Exit

                Case $Button1
ToolTip($Radio1&$Radio3)
                        DllCall("user32.dll","Int","CheckRadioButton","hwnd",$Form1,"Int",$Radio1,"Int",$Radio3,"Int",$Radio1)

        EndSwitch

WEnd
 楼主| 发表于 2011-7-18 18:51:27 | 显示全部楼层
回复 2# lainline


非常感谢!
这也太。。。。
工具害人那
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-1 21:31 , Processed in 0.098506 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表