注册的热键时提示类型不匹配
Option ExplicitPrivate Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Sub Form_Load()
Dim retIP As Long
Dim OutStrIP As String * 256
retIP = GetPrivateProfileString("ini", "IP", "", OutStrIP, 256, "" & App.Path & "\shen.ini")
Dim retPort As Long
Dim OutStrPort As String * 256
retPort = GetPrivateProfileString("ini", "Port", "", OutStrPort, 256, "" & App.Path & "\shen.ini")
Dim retName As Long
Dim OutStrName As String * 256
retName = GetPrivateProfileString("ini", "Name", "", OutStrName, 256, "" & App.Path & "\shen.ini")
txtServerIP = OutStrIP
txtServerPort = OutStrPort
txtName = OutStrName
Dim retdata As Long
Dim OutStrdata As String * 256
retdata = GetPrivateProfileString("data", "path", "", OutStrdata, 256, "" & App.Path & "\shen.ini")
txtdata = OutStrdata
Dim retKey As String
Dim OutStrKey As String * 256
retKey = GetPrivateProfileString("data", "Key", "", OutStrKey, 256, "" & App.Path & "\shen.ini")
txtKey = OutStrKey
Dim ret As Long
'记录原来的window程序地址
preWinProc = GetWindowLong(Me.hwnd, GWL_WNDPROC)
'用自定义程序代替原来的window程序
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf wndproc)
idHotKey = 1 'in the range &h0000 through &hBFFF
uVirtKey1 = txtKey.Text '注册的热键为
ret = RegisterHotKey(Me.hwnd, idHotKey, Modifiers, uVirtKey1)
If ret = 0 Then
MsgBox "注册热键失败,请使用其它热键!", vbCritical, "错误"
End If
Me.cmdQuit.Enabled = False
cmdSend.Enabled = False
End Sub
红色那段在文本中输入"vbKey1"为什么会提示类型不匹配啊???
[[it] 本帖最后由 mayong123 于 2008-11-9 21:38 编辑 [/it]]