Sendkey : ( tự động send 1 phím hoặc nhiều phím bất kì )
Cần : 1 Timer : Interval = 700~ 1000 . Enabled = False
1 Command1.
Code :
- Trích dẫn :
- Private Sub Timer1_Timer()
SendKeys " 123456789~"
Timer1.Enabled=False
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
SendNotifyMessage :
Cần : 1 command . Đổi tên Command1 thành CMD
Cần : 1 Timer .
Code :
- Trích dẫn :
- Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const VK_F1 = &H70
Private Const WM_KEYDOWN As Long = &H100
Private Const WM_KEYUP As Long = &H101
Private Const VK_SPACE = &H20
Private Sub CMD_Click()
If CMD.Caption = "Start" Then
Timer1.Enabled = True
CMD.Caption = "Stop"
Else
Timer1.Enabled = False
CMD.Caption = "Start"
End If
End Sub
Private Sub Timer1_Timer()
Dim AudiHWND As Long
AudiHWND = FindWindow("DLightClass", vbNullString)
If AudiHWND <> 0 Then
SendNotifyMessage AudiHWND, WM_KEYDOWN, VK_SPACE, 0'Send Space
Sleep 30
SendNotifyMessage AudiHWND, WM_KEYUP, VK_SPACE, 0
End If
End Sub
Để send 1 VK Khác. tùy ý thích . các bạn xem ở đây
- Trích dẫn :
- Virtual-Key Codes
Const VK_LBUTTON = &H1
Const VK_RBUTTON = &H2
Const VK_CANCEL = &H3
Const VK_MBUTTON = &H4 ' Middle mouse button (three-button mouse)
Const VK_BACK = &H8
Const VK_TAB = &H9
Const VK_CLEAR = &HC
Const VK_RETURN = &HD
Const VK_SHIFT = &H10
Const VK_CONTROL = &H11
Const VK_MENU = &H12
Const VK_PAUSE = &H13
Const VK_CAPITAL = &H14
Const VK_ESCAPE = &H1B
Const VK_SPACE = &H20
Const VK_PRIOR = &H21
Const VK_NEXT = &H22
Const VK_END = &H23
Const VK_HOME = &H24
Const VK_LEFT = &H25
Const VK_UP = &H26
Const VK_RIGHT = &H27
Const VK_DOWN = &H28
Const VK_SELECT = &H29
Const VK_PRINT = &H2A
Const VK_EXECUTE = &H2B
Const VK_SNAPSHOT = &H2C
Const VK_INSERT = &H2D
Const VK_DELETE = &H2E
Const VK_HELP = &H2F
VK_0 = &H30 0 key
VK_1 = &H31 1 key
VK_2 = &H32 2 key
VK_3 = &H33 3 key
VK_4 = &H34 4 key
VK_5 = &H35 5 key
VK_6 = &H36 6 key
VK_7 = &H37 7 key
VK_8 = &H38 8 key
VK_9 = &H39 9 key
3A–40 Undefined
VK_A = &H41 A key
VK_B = &H42 B key
VK_C = &H43 C key
VK_D = &H44 D key
VK_E = &H45 E key
VK_F = &H46 F key
VK_G = &H47 G key
VK_H = &H48 H key
VK_I = &H49 I key
VK_J = &H4A J key
VK_K = &H4B K key
VK_L = &H4C L key
VK_M = &H4D M key
VK_N = &H4E N key
VK_O = &H4F O key
VK_P = &H50 P key
VK_Q = &H51 Q key
VK_R = &H52 R key
VK_S = &H53 S key
VK_T = &H54 T key
VK_U = &H55 U key
VK_V = &H56 V key
VK_W = &H57 W key
VK_X = &H58 X key
VK_Y = &H59 Y key
VK_Z = &H5A Z key
VK_LWIN = &H5B Left Windows key on a Microsoft Natural Keyboard
VK_RWIN = &H5C Right Windows key on a Microsoft Natural Keyboard
VK_APPS = &H5D Applications key on a Microsoft Natural Keyboard
5E–5F Undefined
VK_NUMPAD0 = &H60 Numeric keypad 0 key
VK_NUMPAD1 = &H61 Numeric keypad 1 key
VK_NUMPAD2 = &H62 Numeric keypad 2 key
VK_NUMPAD3 = &H63 Numeric keypad 3 key
VK_NUMPAD4 = &H64 Numeric keypad 4 key
VK_NUMPAD5 = &H65 Numeric keypad 5 key
VK_NUMPAD6 = &H66 Numeric keypad 6 key
VK_NUMPAD7 = &H67 Numeric keypad 7 key
VK_NUMPAD8 = &H68 Numeric keypad 8 key
VK_NUMPAD9 = &H69 Numeric keypad 9 key
VK_MULTIPLY = &H6A Multiply key
VK_ADD = &H6B Add key
VK_SEPARATOR = &H6C Separator key
VK_SUBTRACT = &H6D Subtract key
VK_DECIMAL = &H6E Decimal key
VK_DIVIDE = &H6F Divide key
VK_F1 = &H70 F1 key
VK_F2 = &H71 F2 key
VK_F3 = &H72 F3 key
VK_F4 = &H73 F4 key
VK_F5 = &H74 F5 key
VK_F6 = &H75 F6 key
VK_F7 = &H76 F7 key
VK_F8 = &H77 F8 key
VK_F9 = &H78 F9 key
VK_F10 = &H79 F10 key
VK_F11 = &H7A F11 key
VK_F12 = &H7B F12 key
VK_F13 = &H7C F13 key
VK_F14 = &H7D F14 key
VK_F15 = &H7E F15 key
VK_F16 = &H7F F16 key
VK_F17 = &H80H F17 key
VK_F18 = &H81H F18 key
VK_F19 = &H82H F19 key
VK_F20 = &H83H F20 key
VK_F21 = &H84H F21 key
VK_F22 = &H85H F22 key
VK_F23 = &H86H F23 key
VK_F24 = &H87H F24 key
88–8F Unassigned
VK_NUMLOCK = &H90 NUM LOCK key
VK_SCROLL = &H91 SCROLL LOCK key
VK_LSHIFT = 0xA0 Left SHIFT
VK_RSHIFT = 0xA1 Right SHIFT
VK_LCONTROL = 0xA2 Left CTRL
VK_RONTROL = 0xA3 Right CTRL
VK_LMENU = 0xA4 Left ALT
VK_RMENU = 0xA5 Right ALT
BA-C0 OEM-specific; reserved. See following tables.
C1-DA Unassigned
DB-E2 OEM-specific; reserved. See following tables.
E3 – E4 OEM-specific
E5 Unassigned
E6 OEM-specific
E7-E8 Unassigned
E9-F5 OEM-specific
VK_ATTN = &HF6 ATTN key
VK_CRSEL = &HF7 CRSEL key
VK_EXSEL = &HF8 EXSEL key
VK_EREOF = &HF9 Erase EOF key
VK_PLAY = &HFA PLAY key
VK_ZOOM = &HFB ZOOM key
VK_NONAME = &HFC Reserved for future use
VK_PA1 = &HFD PA1 key
VK_OEM_CLEAR = &HFFE CLEAR key
OEMs should make special note of the VK key ranges reserved for OEM-specific use: 2A, DB–E4, E6, and E9–F5.
In addition to the VK key assignments in the previous table, Microsoft has assigned the following OEM VK keys.
Symbolic constant Value (Hex) Mouse or keyboard equivalent
VK_OEM_SCROLL = 0x91
VK_OEM_1 = 0xBA “;:” for US
VK_OEM_PLUS = 0xBB “+” any country
VK_OEM_COMMA = 0xBC “,” any country
VK_OEM_MINUS = 0xBD “-” any country
VK_OEM_PERIOD = 0xBE “.” any country
VK_OEM_2 = 0xBF “/?” for US
VK_OEM_3 = 0xC0 “`~” for US
VK_OEM_4 = 0xDB “[{” for US
VK_OEM_5 = 0xDC “|” for US
VK_OEM_6 = 0xDD “]}” for US
VK_OEM_7 = 0xDE “'"” for US
VK_OEM_8 = 0xDF
VK_OEM_AX = 0xE1 AX key on Japanese AX keyboard
VK_OEM_102 = 0xE2 “<>” or “|” on RT 102-key keyboard
================================================== =====================
If you want to send the string "Fo", post the following messages:
WM_KEYDOWN WKeyShift
WM_KEYDOWN WKeyF
WM_KEYUP WKeyF
WM_KEYUP WKeyShift
WM_KEYDOWN WKeyO
WM_KEYUP WKeyO
The destination application messageloop watches the keydown and keyup
messages and posts a WM_CHAR message for each ASCII keydown message it se=
es.
Also keystrokes messages are turned into WM_SYSKEYDOWN, WM_SYSCHAR, and
WM_SYSKEYUP messages for those that had the ALT key down at the time.
If you use SendMessage the messages are not translated in WM_CHAR.
================================================== ======================
· Nonsystem Keystroke
WM_KEYDOWN a key has been pressed
WM_KEYUP a key has been released
WM_CHAR contains the character code of a pressed key
· System Keystroke (While the Alt key is pressed)
WM_SYSKEYDOWN system key has been pressed
WM_SYSKEYUP system key has been released
WM_SYSCHAR Contains the character code while the Alt key is pressed
· A program normally ignore the system keystroke messages and pass them to DefWindowProc()
===========================
The lParam Variable
This 32-bit variable, with 6 fields, is passed to the WndProc()
Bit 0-15 Repeat count; the number of times of keystroke is repeated
Bit 16-23 8-bit OEM scan code
Bit 24 Extended key flag: 1 – extended key; 0 -- otherwise
Bit 25-28 Reserved
Bit 29 Context code: 1=Alt key is pressed; 0=otherwise (100000000000000000000000000000=&H20000000)
Bit 30 Previous key state: 0=previous key up, 1=previous key down (=40000000)
Bit 31 Transition state: 0 – WM_KEYDOWN, 1 – WM_KEYUP
__________________________________________________ ____________
GetAsyncKeyState - Đặt hotkey . ( Ví dụ F3 Chạy msg . F4 Tắt MSG )
Cần : 2 timer. 1 timer Name là Hotkeys và 1 timer1
Code :
- Trích dẫn :
- Private Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Hotkeys_Timer()
If GetAsyncKeyState(vbKeyF4) Then
Timer1.Enabled = True
ElseIf GetAsyncKeyState(vbKeyF5) Then
Timer1.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
MsgBox " Ban Vua Nhan F4"
End Sub
__________________________________________________ ___________________
Tạo 1 Form Dùng để vào server Audition - như Patcher
Code :
Cần : 3 command . command 1 > 3
- Trích dẫn :
- Sub PlayGame(lpParam As String)
Shell "Audition.exe " & lpParam
End Sub
Private Sub Command1_Click()
PlayGame "/T3ENTER 18007C710F05723C1F4D4D303B57042370583835580E257A"
'ha noi
End Sub
Private Sub Command2_Click()
PlayGame "/T3ENTER 1A00FB014F3E4E470639093C73016C7E39052F347A0C64753D 0D"
' Thanh pho
End Sub
Private Sub Command3_Click()
PlayGame "/T3ENTER 13007E4C095D7337646832607E21697D24677F"
' da nang
End Sub
__________________________________________________ ____________________
Kiểm tra Files
Code :
- Trích dẫn :
- Private Sub Form_Load()
On Error Resume Next
Name App.Path & "\Audition.exe" As App.Path & "\Audition.exe"
If Err Then
MsgBox "Không Tìm Thấy Tập Tin Audition.exe! Vui Lòng Copy Form vào Thư Mục Audition"
End'thoát
Else
Msgbox" Đúng thư mục rồi !"
End If
End Sub
Suspen 1 Chương trình bất kì mà không cần ProcessEXp
Cần . Add 1 Modules1
Code Trong Modules :
- Trích dẫn :
- Public Type PROCESS
ID As Long
ExeFile As String
End Type
Public Type THREAD
ID As Long
OwnerProcess As Long
End Type
Private Const TH32CS_SNAPPROCESS = &H2
Private Const TH32CS_SNAPTHREAD = &H4
Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const THREAD_SUSPEND_RESUME = &H2
Private Const MAX_PATH = 260
Private Const hNull = 0
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Type THREADENTRY32
dwSize As Long
cntUsage As Long
th32ThreadID As Long
th32OwnerProcessID As Long
tpBasePri As Long
tpDeltaPri As Long
dwFlags As Long
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" ( _
ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" ( _
ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" ( _
ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Thread32First Lib "kernel32" ( _
ByVal hSnapshot As Long, lpte As THREADENTRY32) As Long
Private Declare Function Thread32Next Lib "kernel32" ( _
ByVal hSnapshot As Long, lpte As THREADENTRY32) As Long
Private Declare Function OpenThread Lib "kernel32" ( _
ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwThreadId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" ( _
ByVal hObject As Long) As Long
Private Declare Function SuspendThread Lib "kernel32" ( _
ByVal hThread As Long) As Long
Private Declare Function ResumeThread Lib "kernel32" ( _
ByVal hThread As Long) As Long
Public Function ListProcesses(Processes() As PROCESS) As Long
Dim aExeName() As String
Dim f As Long, sname As String
Dim hSnap As Long, proc As PROCESSENTRY32
ReDim Processes(0)
ListProcesses = 0
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If hSnap = hNull Then Exit Function
proc.dwSize = Len(proc)
f = Process32First(hSnap, proc)
Do While f
sname = Left$(proc.szExeFile, InStr(1, proc.szExeFile, _
Chr(0)) - 1)
aExeName = Split(sname, "\")
sname = aExeName(UBound(aExeName))
ReDim Preserve Processes(UBound(Processes) + 1)
Processes(UBound(Processes)).ID = proc.th32ProcessID
Processes(UBound(Processes)).ExeFile = sname
ListProcesses = UBound(Processes)
f = Process32Next(hSnap, proc)
Loop
End Function
Public Function ListThreads(Threads() As THREAD) As Long
Dim f As Long
Dim hSnap As Long, THREAD As THREADENTRY32
ReDim Threads(0)
ListThreads = 0
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0)
If hSnap = hNull Then Exit Function
THREAD.dwSize = Len(THREAD)
f = Thread32First(hSnap, THREAD)
Do While f
ReDim Preserve Threads(UBound(Threads) + 1)
Threads(UBound(Threads)).ID = THREAD.th32ThreadID
Threads(UBound( _
Threads)).OwnerProcess = THREAD.th32OwnerProcessID
ListThreads = UBound(Threads)
f = Thread32Next(hSnap, THREAD)
Loop
End Function
Public Function VBSuspendThread(ThreadID As Long) As Long
Dim hThread As Long
VBSuspendThread = -1
hThread = OpenThread( _
STANDARD_RIGHTS_REQUIRED Or THREAD_SUSPEND_RESUME, 0, ThreadID)
If hThread <> hNull Then
VBSuspendThread = SuspendThread(hThread)
Call CloseHandle(hThread)
End If
End Function
Public Function VBResumeThread(ThreadID As Long) As Long
Dim hThread As Long
VBResumeThread = -1
hThread = OpenThread( _
STANDARD_RIGHTS_REQUIRED Or THREAD_SUSPEND_RESUME, 0, ThreadID)
If hThread <> hNull Then
VBResumeThread = ResumeThread(hThread)
Call CloseHandle(hThread)
End If
End Function
Public Function SuspendProcessByName(ProcName As String) As Long
Dim Processes() As PROCESS
Dim numProcesses As Long
Dim X As Long
SuspendProcessByName = 0
numProcesses = ListProcesses(Processes)
For X = 1 To numProcesses
If LCase(Processes(X).ExeFile) = LCase(ProcName) Then
SuspendProcessByName = SuspendProcessByPID(Processes(X).ID)
End If
Next
End Function
Public Function SuspendProcessByPID(ProcID As Long) As Long
Dim Threads() As THREAD
Dim numThreads As Long
Dim X As Long
Dim numThreadsSuspended As Long
numThreadsSuspended = 0
numThreads = ListThreads(Threads)
For X = 1 To numThreads
If Threads(X).OwnerProcess = ProcID Then
If VBSuspendThread(Threads(X).ID) > -1 Then
numThreadsSuspended = numThreadsSuspended + 1
End If
End If
Next
SuspendProcessByPID = numThreadsSuspended
End Function
Public Function ResumeProcessByName(ProcName As String) As Long
Dim Processes() As PROCESS
Dim numProcesses As Long
Dim X As Long
ResumeProcessByName = 0
numProcesses = ListProcesses(Processes)
For X = 1 To numProcesses
If LCase(Processes(X).ExeFile) = LCase(ProcName) Then
ResumeProcessByName = ResumeProcessByPID(Processes(X).ID)
End If
Next
End Function
Public Function ResumeProcessByPID(ProcID As Long) As Long
Dim Threads() As THREAD
Dim numThreads As Long
Dim X As Long
Dim numThreadsResumed As Long
numThreadsResumed = 0
numThreads = ListThreads(Threads)
For X = 1 To numThreads
If Threads(X).OwnerProcess = ProcID Then
If VBResumeThread(Threads(X).ID) > -1 Then
numThreadsResumed = numThreadsResumed + 1
End If
End If
Next
ResumeProcessByPID = numThreadsResumed
End Function
Code Trong Form
- Trích dẫn :
- Private Sub Form_Load()
SuspendProcessByName "Audition.exe" 'Nếu bạn muốn Suspen Audition
End Sub