Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hotkeys in Visual Basic

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
DJpieslice
Newbie cheater
Reputation: 0

Joined: 19 Jul 2007
Posts: 16

PostPosted: Mon May 05, 2008 9:45 am    Post subject: Hotkeys in Visual Basic Reply with quote

I have a question -- How do I make hotkeys in visual basic?
I really need help on this for my first released trainer Surprised
Back to top
View user's profile Send private message
Psy
Grandmaster Cheater Supreme
Reputation: 1

Joined: 27 Mar 2008
Posts: 1366

PostPosted: Mon May 05, 2008 10:16 am    Post subject: Reply with quote

Well declare the function:

Code:

Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer


Then in your main form (under a timer etc) do something like:

Code:

If GetKeyPress(vbKeyA) Then
    <do some stuff>
End If


This is as simple as it can get.
If vbKeyA is pressed then run something you want, such as writing to memory your bytes Smile
Back to top
View user's profile Send private message
DJpieslice
Newbie cheater
Reputation: 0

Joined: 19 Jul 2007
Posts: 16

PostPosted: Mon May 05, 2008 10:24 am    Post subject: Reply with quote

So VBkeyA would be the keyboard button 'A'?

So what if I want to make things like ctrl + S or whatever.

Do I say VBkeya + vbkeyctrl?

or is it more complicated?


Last edited by DJpieslice on Mon May 05, 2008 10:48 am; edited 1 time in total
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon May 05, 2008 4:09 pm    Post subject: Reply with quote

Not sure how WinAPI is called in VB but as you can see here:
http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx

You push the virtual key code onto stack then call the API, then test the return value for whether the key was down or not. This will be of use:
http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx

Not sure if VB uses STDCALL but you'll probably have to use virtual key codes either way.
Back to top
View user's profile Send private message
Psy
Grandmaster Cheater Supreme
Reputation: 1

Joined: 27 Mar 2008
Posts: 1366

PostPosted: Tue May 06, 2008 2:20 am    Post subject: Reply with quote

You can use the virtual keys and/or the vb keys.

Code:

If GetKeyPress(vbKeyShift) And GetKeyPress(vbKeyA) Then
    <do some stuff>
End If


It really doesn't get much plainer.

In future your posts on this topic should be directed to general programming as thats what its there for, and you will get the replies you want if you post in the right place.
Do some searching of your own. You would have been able to find exactly what I told you if you have taken 2 minutes about to search around.
Use them links above to that Slugsnack provided, seen as though he's given them to you.

~Psych
Back to top
View user's profile Send private message
DJpieslice
Newbie cheater
Reputation: 0

Joined: 19 Jul 2007
Posts: 16

PostPosted: Tue May 06, 2008 6:10 am    Post subject: Reply with quote

Thank you very much =)

And, I will post VB-related topics in the general programming section from now on.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites