下面这段代码设置一个按钮,一个文本框,单击一下按钮要把内容显示在文本框里,请问高手要怎么改?

PrivateDeclareFunctionRegCloseKeyLib"advapi32.dll"(ByValhKeyAsLong)AsLongPrivateDecla... Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
Private Sub Form_Load()
Dim hKey As Long, Cnt As Long, sName As String
If RegOpenKey(&H80000002, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", hKey) = 0 Then
sName = Space(255)
While RegEnumKeyEx(hKey, Cnt, sName, 255, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> 259&
Debug.Print Left$(sName, InStr(sName, Chr(0)) - 1)
Cnt = Cnt + 1
sName = Space(255)
Wend
RegCloseKey hKey
End If
End Sub
展开
 我来答
tianqing20wen

2011-01-16 · TA获得超过2.4万个赞
知道大有可为答主
回答量:8226
采纳率:88%
帮助的人:5144万
展开全部
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long

Private Sub Command1_Click()
Dim hKey As Long, Cnt As Long, sName As String
If RegOpenKey(&H80000002, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", hKey) = 0 Then
sName = Space(255)
While RegEnumKeyEx(hKey, Cnt, sName, 255, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> 259&
s = s & Left$(sName, InStr(sName, Chr(0)) - 1) & vbCrLf
Cnt = Cnt + 1
sName = Space(255)
Wend
RegCloseKey hKey
End If
Text1.Text = s
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式