You do not use GetASyncKeyState for that.
Use the Form.KeyDown event.
Hi,
Here is my problem.
I want to get the key that the user press in my label1.text
Is that right ?
And if it is do I put it in form1_load sub ?Code:If (GetAsyncKeyState(65)) Then Label1.Text = Label1.Text & "a" End If
Or like a While something True ?
Thanks for help guyz !
Sorry for my bad English ! I'm French Canadian !
- When you use my hack, Please Thank Me
Release some Hacks []
Able to code in PhP / Mysql []
Able to code in VB []
Able to code in C# []
Able to do VB Injector []
Release an Injector []
Active Member in the Community []
Member who help small Hacker []
You do not use GetASyncKeyState for that.
Use the Form.KeyDown event.
What if he wants it to appear even when the form isn't focused, or when he has other controls focused on the form though? :/
I'll run through both methods though, you'd have to find a workaround for the Form_KeyDown if you have multiple controls as you can't select your actual form as if it were a control (i.e clicking on the blank form will not make it focused if there are other controls). Anywho:
[php]
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Label1.Text = e.KeyCode.ToString
End Sub
[/php]
And with GetAsyncKeyState (would require a timer!)
[php]
For i As Integer = 0 to 255
If GetAsyncKeyState(i) Then
Dim kCon As New KeysConverter
Label1.Text = kCon.ConvertToString(i)
TimerName.Stop
Exit For
End If
Next
[/php]
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
I'm not seeing your point with the KeyPreview...
Also, unless he has ONLY labels on his form (no buttons etc) handling only the form's keydown event won't work as expected (i.e not at all)
EDIT. After reading the documentation it seems KeyPreview is the way to go after all
[php]
Me.KeyPreview = True
[/php]
Put the above code right before you need to display the next keypress in a label,
Last edited by Jason; 10-18-2010 at 02:24 AM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Oh god... if he wants all KeyDown, KeyPress, KeyUp to be used, he uses KeyPreview propriety.. if not.. He will use the one that he feels like using. =D
Light travels faster than sound. That's why most people seem bright until you hear them speak.
The thing I want is :
But i'm not **** able to do this !!Code:If Key A Down Then Label1.Text = Label1.Text & "a" End if
Sorry for my bad English ! I'm French Canadian !
- When you use my hack, Please Thank Me
Release some Hacks []
Able to code in PhP / Mysql []
Able to code in VB []
Able to code in C# []
Able to do VB Injector []
Release an Injector []
Active Member in the Community []
Member who help small Hacker []
This work fine
But when I replace TextBox1 by Form1 nothing work ... :SCode:Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown Select Case e.KeyCode Case Keys.A Label1.Text = "a" End Select End Sub
Sorry for my bad English ! I'm French Canadian !
- When you use my hack, Please Thank Me
Release some Hacks []
Able to code in PhP / Mysql []
Able to code in VB []
Able to code in C# []
Able to do VB Injector []
Release an Injector []
Active Member in the Community []
Member who help small Hacker []