Tulis kode berikut di event '(Declarations)' dari Form
[ VB 6.0 ]
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
[ VB .NET ] Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function SendMessage Lib"user32.dll" Alias
"SendMessageA"(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal
wParam As Integer, ByRef lParam As Object) As Integer
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Sekarang untuk mempraktekkannya gunakan kode seperti berikut :
[ VB 6.0 ]
SendMessage Command1.hwnd, &HF3, 1, 0
Sleep 150
SendMessage Command1.hwnd, &HF3, 0, 0
Command1.Value = True
Sleep 150
SendMessage Command1.hwnd, &HF3, 0, 0
Command1.Value = True
[ VB .NET ]
SendMessage(Button1.Handle, WM_LBUTTONDOWN, 0, 0)
Application.DoEvents()
Threading.Thread.Sleep(150)
SendMessage(Button1.Handle, WM_LBUTTONUP, 0, 0)
Button1.PerformClick()
Application.DoEvents()
Threading.Thread.Sleep(150)
SendMessage(Button1.Handle, WM_LBUTTONUP, 0, 0)
Button1.PerformClick()
Tidak ada komentar:
Posting Komentar
Catatan: Hanya anggota dari blog ini yang dapat mengirim komentar.