Ok...langsung saja
1. Buka Projetc baru di visual basic 6.0 ( VB6 )
2. Siapkan 1 commandbutton
3. Tambahkan module pada project baru
- Klik Project
- Pilih Add Module
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long)5. Ketik/copy paste code berikut kedalam Form pembaca
As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As
String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
Public Const NV_CLOSEMSGBOX As Long = &H5000&
Public Sub TimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal
dwTime As Long)
KillTimer hWnd, idEvent
Select Case idEvent
Case NV_CLOSEMSGBOX
Dim hMessageBox As Long
hMessageBox = FindWindow("#32770", "tester msgbox ilang")
If hMessageBox Then
Call SetForegroundWindow(hMessageBox)
SendKeys "{enter}"
End If
End Select
End Sub
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long,6. Silahkan jalankan project pembaca, dan tekan tombol command nya, akan muncul msgbox
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Sub Command1_Click()
SetTimer hWnd, NV_CLOSEMSGBOX, 4000, AddressOf TimerProc
MsgBox "test 123", vbOKCancel + vbDefaultButton1, "tester msgbox ilang"
End Sub
berupa pesan "Test 123" dan akan hilang otomatis setelah 4 detik ;)
Sample project bisa didownload disini
Password : dewakhaest
0 comments:
Post a Comment