|
悬赏50金钱已解决
本帖最后由 东风烈烈 于 2015-2-3 16:20 编辑
问题解决了,正确的如下(主题在后面加了(已解决)却不显示,不知怎么弄):
WinActivate("国内期货")
;Sleep(1000)
WinWaitActive("国内期货")
If $LKBSA = "{F1}" Then
Select
Case $BSVOL2 > 1
For $I = 0 To $BSVOL2 - 1
$hwnd = ControlGetHandle("国内期货", "","[CLASS:Button;INSTANCE:2]")
$pos = ControlGetPos("国内期货","","[CLASS:Button;INSTANCE:2]")
$X = String(Hex(Int($pos[2]/2), 4))
$Y = String(Hex(Int($pos[3]/2), 4))
$lParm = "0x" & $Y & $X
_WinAPI_PostMessage($hwnd, 0x200, 0x0, $lParm)
_WinAPI_PostMessage($hwnd, 0x201, 0x1, $lParm)
_WinAPI_PostMessage($hwnd, 0x202, 0x0, $lParm)
; ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:2]")
;_GUICtrlButton_Click($handle)
Sleep(200)
Next
Case $BSVOL2 = 1
$hwnd = ControlGetHandle("国内期货", "","[CLASS:Button;INSTANCE:2]")
$pos = ControlGetPos("国内期货","","[CLASS:Button;INSTANCE:2]")
$X = String(Hex(Int($pos[2]/2), 4))
$Y = String(Hex(Int($pos[3]/2), 4))
$lParm = "0x" & $Y & $X
_WinAPI_PostMessage($hwnd, 0x200, 0x0, $lParm)
_WinAPI_PostMessage($hwnd, 0x201, 0x1, $lParm)
_WinAPI_PostMessage($hwnd, 0x202, 0x0, $lParm)
; ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:2]")
;_GUICtrlButton_Click($handle)
Sleep(200)
EndSelect
EndIf
上面为正确能执行的源码!原来不能执行是因为要把鼠标放在上面(这个现在我还是不明白)。下面的为不能执行的原来代码。再次谢谢帮忙解决问题的朋友。
代码如下,请高手指点一下,很急。先谢谢了!!!!
If $LKBSA = "{F3}" Then
Select
Case $BSVOL2 > 1
For $I = 0 To $BSVOL2 - 1
ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:3]")
;_GUICtrlButton_Click($handle)
Sleep(200)
Next
Case $BSVOL2 = 1
ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:3]")
;_GUICtrlButton_Click($handle)
Sleep(200)
EndSelect
EndIf
If $LKBSA = "{F2}" Then
Select
Case $BSVOL2 > 1
For $I = 0 To $BSVOL2 - 1
ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:4]")
;_GUICtrlButton_Click($handle)
Sleep(200)
Next
Case $BSVOL2 = 1
ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:4]")
;_GUICtrlButton_Click($handle)
Sleep(200)
EndSelect
EndIf
If $LKBSA = "{F4}" Then
Select
Case $BSVOL2 > 1
For $I = 0 To $BSVOL2 - 1
ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:4]")
;_GUICtrlButton_Click($handle)
Sleep(200)
Next
Case $BSVOL2 = 1
ControlFocus("国内期货","","Button2")
ControlClick("国内期货","","[CLASS:Button;INSTANCE:2]","left")
;Local $handle = ControlGetHandle("国内期货","","[CLASS:Button; INSTANCE:4]")
;_GUICtrlButton_Click($handle)
Sleep(200)
EndSelect
|
附件: 您需要 登录 才可以下载或查看,没有账号?加入
最佳答案
查看完整内容
[au3]WinActivate("国内期货")
WinWaitActive("国内期货")
If $LKBSA = "{F1}" And $BSVOL2 > 0 Then
For $i = 1 To $BSVOL2
_ControlClick("国内期货", "", "[CLASS:Button;INSTANCE:2]")
Sleep(200)
Next
EndIf
Func _ControlClick($iTitle, $iText, $iControl)
Local $hwnd = ControlGetHandle($iTitle, $iText, $iControl)
Local $pos = ControlGetPos($iTitle, $iText, $iControl)
Local $lParm = "0x" & String(He ...
|