怎么写按钮事件
点击按钮触发一下代码事件$var = IniRead("execution.ini", "QQ", "QQ", "")
Run($var)
不知道该怎么写进去
这是窗体代码
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$var1=IniRead("execution.ini","Form","width","")
$var2=IniRead("execution.ini","Form","height","")
$Form1 = GUICreate("Menu", $var1, $var2, -1,-1)
$Form1context = GUICtrlCreateContextMenu()
$MenuItem2 = GUICtrlCreateMenuItem("Add", $Form1context)
$MenuItem1 = GUICtrlCreateMenuItem("Exit", $Form1context)
$Button1 = GUICtrlCreateButton("Button1", 24, 32, 57, 57, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 88, 32, 57, 57, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Button3", 152, 32, 57, 57, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Button4", 24, 96, 57, 57, $WS_GROUP)
$Button5 = GUICtrlCreateButton("Button5", 152, 96, 57, 57, $WS_GROUP)
$Button6 = GUICtrlCreateButton("Button6", 88, 96, 57, 57, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd 你是用 Koda 编辑器?
那在设置各控件时, 鼠标双击按钮等控件, 就会有个添加 '事件通知' 的信息框, 直接确定就行了.
然后要按 F10 切换到 Scite 编辑器中编写相应按钮 '事件 '的代码!
注意编写好后要'另存为..', 该文件是在临时文件夹里, 且容易被 Koda 覆盖掉! Switch 照着Case $GUI_EVENT_CLOSE添
Case $Button1
$var = IniRead("execution.ini", "QQ", "QQ", "")
Run($var)
就行了 看帮助文件就能够知道怎么做了,有现成的例子啊! While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$var = IniRead("execution.ini", "QQ", "QQ", "")
Run($var)
Case $Button2
Run($var)
Case $Button3
Run($var)
Case $Button4
Run($var)
EndSwitch
WEnd
完整了吧 5楼已完美回答,也可以写成函数调用事件模式!
页:
[1]