找回密码
 加入
搜索
查看: 1916|回复: 4

关于GUICtrlCreateListView操作问题。

[复制链接]
发表于 2008-10-23 12:55:21 | 显示全部楼层 |阅读模式
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 303, 339, 321, 178)
$ListView1 = GUICtrlCreateListView("键值|值", 0, 8, 289, 273)
$button = GUICtrlCreateButton("Yes", 75, 290, 80, 40)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $button
                        Read()
        EndSwitch
WEnd
Func read()
For $i = 1 to 10
        $ver = RegEnumVal("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$i)
        if @error <> 0 Then ExitLoop
        MsgBox(0,"",$ver)
Next
EndFunc
请问如何将注册表RUN下面的“项”显示到GUICtrlCreateListView的键值里,“值”显示到CtrlCreateListView的值里。

[ 本帖最后由 xg911335 于 2008-10-24 22:22 编辑 ]
 楼主| 发表于 2008-10-23 14:13:07 | 显示全部楼层
如果我想加一个$button1 = GUICtrlCreateButton("Del", 155, 290, 80, 40)。用来删除选中的选项,如何写。感谢2楼的兄弟。
发表于 2008-10-23 15:20:12 | 显示全部楼层
RegDelete ( "键名" [, "值项"] )
然后刷新
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 303, 339, 321, 178)
$ListView1 = GUICtrlCreateListView("键值 |值", 0, 8, 289, 273)
$button = GUICtrlCreateButton("Yes", 75, 290, 80, 40)
$delete = GUICtrlCreateButton("删除", 175, 290, 80, 40)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $button
                        read()
                Case $delete
                        del()
        EndSwitch
WEnd
Func read()
        _GUICtrlListView_DeleteAllItems($ListView1)
        For $i = 1 To 10
                $ver = RegEnumVal("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i)
                If @error <> 0 Then ExitLoop
                $aer = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$ver)
                $a = GUICtrlCreateListViewItem($ver & "|" & $aer, $ListView1)
        Next
EndFunc   ;==>read

Func del()
        $delitem = _GUICtrlListView_GetItemText($ListView1,Number(_GUICtrlListView_GetSelectedIndices($ListView1)))
        RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$delitem)
        read()
EndFunc   ;==>del

[ 本帖最后由 大绯狼 于 2008-10-23 15:29 编辑 ]
发表于 2008-10-24 21:33:14 | 显示全部楼层
上楼很热情!楼主解决了也要改为解决啊!ps
 楼主| 发表于 2008-10-24 22:22:58 | 显示全部楼层
感谢各位。已解决。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-10 21:06 , Processed in 0.071273 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表