下面这段代码设置一个按钮,一个文本框,单击一下按钮要把内容显示在文本框里,请问高手要怎么改?
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 展开
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 展开
1个回答
展开全部
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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询