Rabu, 27 Januari 2010
Key arrow
Source Code :
Private Sub cmd_start_Click()
cmd_start.Visible = 0
keyOn = 1
Label1.Visible = 1
End Sub
Private Sub Timer1_Timer()
Call movea
End Sub
Module Code :
Option Explicit
Public keyOn As Boolean
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Sub movea()
If keyOn Then
If GetAsyncKeyState(vbKeyUp) Then
Form1.Shape1.BackColor = vbBlue
End If
If GetAsyncKeyState(vbKeyDown) Then
Form1.Shape1.BackColor = vbRed
End If
If GetAsyncKeyState(vbKeyRight) Then
Form1.Shape1.BackColor = vbYellow
End If
If GetAsyncKeyState(vbKeyLeft) Then
Form1.Shape1.BackColor = vbGreen
End If
If GetAsyncKeyState(vbKeyEscape) Then
keyOn = False
Form1.Label1.Visible = 0
Form1.cmd_start.Visible = 1
End If
End If
End Sub
Link Download :
http://www.4shared.com/file/209540512/3b1868b0/Contoh_GetAsyncKeyStatedfd.html
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar