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 


[VB2008] how to use multiple hotkeys with code?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
haxor5354
Master Cheater
Reputation: 0

Joined: 11 Jan 2008
Posts: 306
Location: Toronto

PostPosted: Thu Jun 05, 2008 3:14 pm    Post subject: [VB2008] how to use multiple hotkeys with code? Reply with quote

Code:
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
    Private Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer
    Public Const WM_HOTKEY As Integer = &H312

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RegisterHotKey(Me.Handle.ToInt32, 0, 0, System.Windows.Forms.Keys.F11)'edit this for the hotkey you want
    End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        If m.Msg = WM_HOTKEY Then
          'code for if they press hotkey here   
            Else 
            End If
        End If
        MyBase.WndProc(m)
    End Sub
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
                   UnregisterHotKey(Me.Handle.ToInt32, 0)
           End Sub



I only can get 1 HotKey working, I tried lots of different thing but no luck =(

help plz?

_________________


My Rig
MoBo: Asus P5QPL-AM
Cpu: Intel Core 2 Quad Q8200
Ram: Kingston 2x2GB DDR2 800
GFX: Asus ENGTS250 DK
HDD: 500GB WD Caviar Green
Mon: LG Flatron W2243T 1080p
Back to top
View user's profile Send private message MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Thu Jun 05, 2008 3:30 pm    Post subject: Reply with quote

Well, you add another RegisterHotkey after the one you have, and in you're messagehandler, add something like this:
Code:

        If m.Msg = WM_HOTKEY Then
            If m.wParam = KEY_IDENTIFIER_OF_KEY_1
                      'code for if they press hotkey1 here
            Else If m.wParam = KEY_IDENTIFIER_OF_KEY_2
                      'code for if they press hotkey2 here
            End If
        End If
Back to top
View user's profile Send private message
haxor5354
Master Cheater
Reputation: 0

Joined: 11 Jan 2008
Posts: 306
Location: Toronto

PostPosted: Thu Jun 05, 2008 3:35 pm    Post subject: Reply with quote

how to declare
Code:
KEY_IDENTIFIER_OF_KEY_1
and
Quote:
KEY_IDENTIFIER_OF_KEY_2
Code:

_________________


My Rig
MoBo: Asus P5QPL-AM
Cpu: Intel Core 2 Quad Q8200
Ram: Kingston 2x2GB DDR2 800
GFX: Asus ENGTS250 DK
HDD: 500GB WD Caviar Green
Mon: LG Flatron W2243T 1080p
Back to top
View user's profile Send private message MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Thu Jun 05, 2008 9:46 pm    Post subject: Reply with quote

Get a C# to VB.NET converter, and convert my static keyboard hook classes in the GP+ section, then add those to your project.
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Jun 06, 2008 12:15 am    Post subject: Reply with quote

haxor5354 wrote:
how to declare
Code:
KEY_IDENTIFIER_OF_KEY_1
and
Quote:
KEY_IDENTIFIER_OF_KEY_2
Code:

You don't, its the ID of the key. (ID parameter, RegisterHotKey...)
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 programming 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