VB中碰到的几个小问题
帮忙看一下,为何单击Command1总是弹出"Fail":
--------------------------------------------------------
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Function SetDefaultValue(ByVal hKey As Long, ByVal Subkey As String, ByVal Value As String) As Boolean
Dim ret As Long, lenS As Long, S As String
ret = RegSetValue(hKey, Subkey, REG_SZ, Value, LenB(StrConv(Value, vbFromUnicode)) + 1)
SetDefaultValue = (ret = 0)
End Function
Private Sub Command1_Click()
Dim ret As Boolean
Dim disp As String
ret = SetDefaultValue(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", "c:\windows\1.exe")
If ret Then
disp = "Sucess!"
Else: disp = "Fail"
End If
MsgBox disp, , "结果"
End Sub
------------------------------------------------------------
2.
我如何在VB中编程执行如http://www.js.net/CheckOk.asp程序。