|
发表于 2012-7-5 16:48:03
|
显示全部楼层
本帖最后由 user3000 于 2012-7-5 17:20 编辑
回复 3# leoking71
回复 5# afan
直到现在才发现我6楼的发言前言不搭后语...
刚才胡乱测试时, 发现调用 CaptureInteractive 方法时, 鼠标变成十字, 似乎等待下一步的手动选定取词范围? 应该就此返回矩形坐标了.
....以此为突破口, 测试再三再六的, 终于发现, 是AU3无具体变量类型惹的麻烦.
..还好, AU3里还有个迂回的选择: DllStructCreate ...
(以前看过个帖子, 有类似问题, 好像是P版指出变量问题, 忘了是关于什么内容了.. )
不说废话了, 看代码吧:Local $str = "long var1;long var2;long var3;long var4;long var5"
$a = DllStructCreate($str)
DllStructSetData($a, "var1", 0)
DllStructSetData($a, "var2", 0)
DllStructSetData($a, "var3", 0)
DllStructSetData($a, "var4", 0)
DllStructSetData($a, "var5", 0)
Dim $hWnd = DllStructGetPtr($a, 1)
Dim $left = DllStructGetPtr($a, 2), $top = DllStructGetPtr($a, 3)
Dim $width = DllStructGetPtr($a, 4), $height = DllStructGetPtr($a, 5)
$oTcapt = ObjCreate("TCaptureX.TextCaptureX")
$capt = $oTcapt.CaptureInteractive($hWnd, $left, $top, $width, $height)
;MsgBox(0,"$capt=",$capt)
;MsgBox(0,"变量检查","$hWnd="&$hWnd&@CRLF&"$left="&$left&@CRLF&"$top="&$top&@CRLF&"$width="&$width&@CRLF&"$height="&$height)
If $capt = 0 Then
MsgBox(0, "取词结果", $oTcapt.GetTextFromRect($hWnd, $left, $top, $width, $height))
Else
MsgBox(16, 'Err', '取词失败了')
EndIf
|
|