|
发表于 2009-5-15 00:36:29
|
显示全部楼层
http://www.autoitx.com/forum.php?mod=viewthread&tid=7051&highlight
请大家移步到以上链接,回复贴有相关附件下载
我琢磨了一下
结合sxd 和netegg 的启发
ControlTreeView ( "title", "text", controlID, "command" [, option1 [, option2]] )
参数:
command ---> The command to send to the control
option1 --- >[optional] Additional parameter required by some commands.
其中command有一个命令为"GetText": Returns the text of an item.
再看option的应用说明:
The "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0-based.
举例:
Heading1
----> H1SubItem1
----> H1SubItem2
----> H1SubItem3
----> ----> H1S1SubItem1
Heading2
Heading3
Each "level" is separated by |. An index is preceded with #.
对应上面举例再深入举一个例子:
Heading2可表达为 "Heading2" 或"#1"
H1SubItem2 可表达为"Heading1|H1SubItem2" 或"#0|#1"
H1S1SubItem1 可表达为"Heading1|H1SubItem3|H1S1SubItem1" 或"#0|#2|#0"
如此,就可知道怎么读取楼主提出的类似窗体的内容啦
为了大家看着容易明白,我写了一个"读取温度仪",遇上过这个问题的可以参考一下:
- #include <GUIConstantsEx.au3>
- #Include <GuiListbox.au3>
- Local $a,$Msg,$temp,$temp1,$temp2,$temp3,$temp4
- $a = 'CPUID Hardware Monitor'
- WinActivate($a,'')
- GUICreate(" 读取温度仪 ", 320, 220, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018)
- GUISetBkColor(0x666FF )
- GUICtrlCreateLabel("By lynfr8"&@CRLF&"2009.5.14", 200, 165, 60, 40)
- GUICtrlCreateLabel("使用说明:"&@CRLF&"请先打开 Hardware Monitor"&@CRLF&"然后点击你需查看的温度", 50, 25, 300, 50)
- $temp1 = GUICtrlCreateButton("主板温度", 40, 85, 100, 20)
- $temp2 = GUICtrlCreateButton("cpu温度", 40, 105, 100, 20)
- $temp3 = GUICtrlCreateButton("显卡温度", 40, 125, 100, 20)
- $temp4 = GUICtrlCreateButton("硬盘温度", 40, 145, 100, 20)
- GUISetState()
- While 1
- $Msg = GUIGetMsg()
- Switch $Msg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $temp1
- temp1()
- Case $temp2
- temp2()
- Case $temp3
- temp3()
- Case $temp4
- temp4()
- EndSwitch
- WEnd
- Func temp1()
- $temp = ControlTreeView($a, "", "SysTreeView321", "GetText", "#0|#0|#1|#0")
- MsgBox(4096,'',"主板温度:"&$temp)
- EndFunc
- Func temp2()
- $temp = ControlTreeView($a, "", "SysTreeView321", "GetText", "#0|#1|#0|#0")
- MsgBox(4096,'',"cpu温度:"&$temp)
- EndFunc
- Func temp3()
- $temp = ControlTreeView($a, "", "SysTreeView321", "GetText", "#0|#2|#0|#0")
- MsgBox(4096,'',"显卡温度:"&$temp)
- EndFunc
- Func temp4()
- $temp = ControlTreeView($a, "", "SysTreeView321", "GetText", "#0|#3|#0|#0")
- MsgBox(4096,'',"硬盘温度:"&$temp)
- EndFunc
|
|