www1970 发表于 2014-4-16 09:31:37

listview选中状态失效咋回事(已解决)

本帖最后由 www1970 于 2014-4-21 10:50 编辑

制作加密软件TrueCrype(http://www.truecrypt.org/downloads可下载)自动加载程序时,在选择分区时,可以选中最后一个加密分区,但是“确定”按钮点击时,分区选择失效,这问题咋解决呀!
见下图
1、选中最后一个隐藏分区

2、点击“OK”按钮后

代码如下:
;启动truecrypt
Run("C:\Program Files\TrueCrypt\truecrypt.exe")
;界面启动后选择“选择设备”
WinWaitActive("TrueCrypt","Select D&evice...")
Send("!e")
;出现分区选择界面,选择最后一个分区
WinWait("Select a Partition or Device")
$itm=ControlListView("Select a Partition or Device","","SysListView321","GetItemCount")
ControlFocus("Select a Partition or Device","","SysListView321")
ControlListView("Select a Partition or Device","","SysListView321","Select",$itm-1)
;点击“OK”按钮
ControlFocus("Select a Partition or Device","","Button2")
ControlClick("Select a Partition or Device","","Button2")

www1970 发表于 2014-4-16 16:54:30

请求增援!

www1970 发表于 2014-4-17 09:12:10

高手请帮忙!

www1970 发表于 2014-4-17 13:07:29

是这问题太低级了,高手不屑于回答,还是没碰到过不知如何解决呀?
俺很郁闷呀!
刚学就碰到这难题

121044246 发表于 2014-4-20 00:28:43

回复 1# www1970


    我也是新手。你这样选择不行的话,我换个思路,就是获取listview选中的文本,直接输入。你试试看Run("C:\Program Files\TrueCrypt\truecrypt.exe")

WinWaitActive("TrueCrypt","Select D&evice...")

ControlClick("TrueCrypt","Select D&evice...","Select D&evice...")

WinWait("Select a Partition or Device")
$itm=ControlListView("Select a Partition or Device","","SysListView321","GetItemCount")

$Device= ControlListView("Select a Partition or Device","","SysListView321","GetText",$itm-1)

ControlClick("Select a Partition or Device","","Cancel")

WinWaitActive("TrueCrypt","Select D&evice...")

ControlSetText("TrueCrypt","Select D&evice...","Edit1",$Device)

www1970 发表于 2014-4-21 10:49:20

回复 5# 121044246


    这个方法成功了,谢谢!!!!

121044246 发表于 2014-4-21 23:55:42

回复 6# www1970


    呵呵,可以就好。一起学习
页: [1]
查看完整版本: listview选中状态失效咋回事(已解决)