窗体中的代码:
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpDefault As String, ByVal lpRetunedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function SaveINI Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As String, ByVal lplFileName As String) As Long
Dim i As Integer
Dim cur As Integer
Function GetINI(AppName As String, KeyName As String, filename As String) As String
Dim RetStr As String
RetStr = String(10000, Chr(0))
GetINI = Left(RetStr, GetPrivateProfileString(AppName, ByVal KeyName, "", RetStr, Len(RetStr), filename))
End Function Private Sub Check1_Click()
If Check1.Value = 1 Then
cur = 0
Timer1.Enabled = True
Timer1.Interval = Combo1.Text
Else
Timer1.Enabled = False
End If '这里是选中后的事件,具体你可以自己写
End Sub Private Sub Form_Load()
Dim ret As Long preWinProc = GetWindowLong(Me.hwnd, GWL_WNDPROC) '记录原来的window程序地址 ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf Wndproc) '用自定义程序代替原来的window程序
idHotKey = 1
Modifiers = MOD_ALT
uVirtKey = vbKeyF1
ret = RegisterHotKey(Me.hwnd, idHotKey, Modifiers, uVirtKey) End Sub Public Sub UnRegHotKey(hwnd As Long)
Dim ret As Long
'取消Message的截取,使之送往原来的windows程序
ret = SetWindowLong(hwnd, GWL_WNDPROC, preWinProc)
Call UnregisterHotKey(hwnd, uVirtKey) End Sub Private Sub Form_Unload(Cancel As Integer)
Dim ret As Long
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, preWinProc)
Call UnregisterHotKey(Me.hwnd, uVirtKey)
For i = 1 To List1.ListCount
SaveINI "list", CStr(Format(i - 1, "000")), List1.List(i - 1), App.Path & "\Config.ini"
Next i
SaveINI "ListCount", "Count", List1.ListCount, App.Path & "\Config.ini" End Sub Private Sub Command1_Click()
List1.AddItem Text1.Text
End Sub Private Sub Command2_Click()
For i = 0 To List1.ListCount - 1
List1.RemoveItem i
Exit For
Next
End Sub Private Sub Command4_Click()
Timer1.Enabled = False
End Sub Private Sub Command5_Click()
Shell "explorer.exe
http://1157458727.qzone.qq.com"
End Sub Private Sub Timer1_Timer() 'appacticave "程序标题" SendKeys List1.List(cur)
SendKeys "{enter}"
cur = cur + 1
If cur = List1.ListCount Then
cur = 0
End If
End Sub