|
本帖最后由 yufei8051 于 2014-9-23 15:53 编辑 #include <GuiTreeView.au3>
#include <WinAPI.au3>
#include <PostMessage_UDF.au3>
;声明变量
Local $csyjsl, $yjsl, $dqyj, $clyj
Local $qsbz,$mmbz, $gpdm, $mmsl, $Getmmjg, $Getmmsl
Local $GetFocusEdit1x, $GetFocusEdit2x, $GetFocusEdit3x, $rzjl
Local $Getstringx, $Getstringx1, $Getstringx2, $Getstringx3, $Getstringx4
Local $tdjg = 1111 ;填单间隔
Local $wsgpjyxt = "网上股票交易系统5.0"
;If Not WinActive($wsgpjyxt, "") Then WinActivate($wsgpjyxt, "") ;激活交易软件
Sleep($tdjg)
$wsjywtxt_hwnd = WinGetHandle("网上股票交易系统5.0")
_Sendkeys($wsjywtxt_hwnd, "{F3}");选择撤单以清除可能存在的乱码
Sleep($tdjg)
_Sendkeys($wsjywtxt_hwnd, "{F1}");等待50毫秒后选择买入
Sleep($tdjg)
;逐次获取同花顺焦点处控件的类别名
GetThsEditX()
Func GetThsEditX()
Local $i, $j, $Gfys = 500;每次扫描间隔延时
For $i = 1 To 3 Step 1
$j = $j + 1
Switch $j
Case 1
Sleep($Gfys)
$GetFocusEdit1x = ControlGetFocus($wsgpjyxt, "") ;获取焦点处控件的类别名
;Send("{Enter}")
_Sendkeys($wsjywtxt_hwnd, "{TAB}")
;_WinAPI_PostMessage($wsjywtxt_hwnd, 0x0100,13, 0)
Case 2
Sleep($Gfys)
$GetFocusEdit2x = ControlGetFocus($wsgpjyxt, "") ;获取焦点处控件的类别名
_Sendkeys($wsjywtxt_hwnd, "{Enter}")
Case 3
Sleep($Gfys)
$GetFocusEdit3x = ControlGetFocus($wsgpjyxt, "") ;获取焦点处控件的类别名
EndSwitch
Next
Sleep($Gfys)
MsgBox(262149,"测试",$GetFocusEdit1x&$GetFocusEdit2x&$GetFocusEdit3x,2)
ControlFocus($wsgpjyxt, "", $GetFocusEdit1x);设置指定控件为当前焦点
EndFunc ;==>GetThsEditX
激活窗口的情况下,用 send() 就可以了。
.
.
后台情况下,前面用
_Sendkeys($wsjywtxt_hwnd, "{F1}"); 正常,
但是发送
_Sendkeys($wsjywtxt_hwnd, "{TAB}");
_Sendkeys($wsjywtxt_hwnd, "{ENTER}");
就没反应
用 _WinAPI_PostMessage($wsjywtxt_hwnd, 0x0100,13, 0) 发送回车 也没反应
参照这个帖子:http://www.autoitx.com/forum.php ... 3%CC%A8%B7%A2%CB%CD
也没弄好
有劳高手指教 |
|