本帖最后由 lnlyf 于 2012-9-15 13:39 编辑
想加一个按钮成这样:
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("股票代码获取器", 260, 22, 592, 524, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Input1 = GUICtrlCreateInput("", 8, 2, 150, 17)
GUICtrlSetColor(-1, 0xFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("同步", 165, 2, 41, 17, $WS_GROUP)
$Button2 = GUICtrlCreateButton("买入", 215, 2, 41, 17, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Button1Click")
GUICtrlSetOnEvent(-1, "Button2Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ##
Global $sss
While 1
$BT=ControlGetText ("飞狐交易师 - ", "", 65281 ) ;取窗口全标题飞狐交易师 - 专业版 - [东方电子 SZ000682]
;$BT="飞狐交易师 - 专业版 - [东方电子 SZ000682] "
$sss=StringRegExp($BT,'\d{6}',1)
; If StringLen($sss[1]
ControlSetText ( "股票代码获取器", "","Edit1", "当前代码:" & $sss)
Sleep(500)
WEnd
Func Button1Click()
If WinExists("[CLASS:TdxW_MainFrame_Class]") Then
; MsgBox(0, "", "财富通打开")
WinActivate("[CLASS:TdxW_MainFrame_Class]")
; Send("600500")
Send($sss[0])
Sleep(1000)
Send("{ENTER}")
MsgBox(0, "", "发送结束")
Else
MsgBox(0, "", "财富通没有打开")
EndIf
EndFunc
Func Button2Click()
If WinExists("[CLASS:TdxW_MainFrame_Class]") Then
; MsgBox(0, "", "财富通打开")
WinActivate("[CLASS:TdxW_MainFrame_Class]")
; Sleep(100)
; Send("600500")
Send($sss[0])
Sleep(300)
Send("{ENTER}")
; MsgBox(0, "", $sss[0])
Else
MsgBox(0, "", "买入")
EndIf
EndFunc
Func Form1Close()
exit
EndFunc |