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 


need help with a vb code for +rep

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

Joined: 17 Aug 2008
Posts: 579

PostPosted: Tue May 05, 2009 9:14 pm    Post subject: need help with a vb code for +rep Reply with quote

ok i need to know a code to do the following

press Ctrl, shift, and~ all at that same time
but i need it to be so that after that is will type something like cat then hit enter but only do it after you hit a hotkey like f9

Please help +rep if you do

_________________
Views and counting since 9/14/09

Make Money for surfing ads!
Back to top
View user's profile Send private message
92Garfield
I'm a spammer
Reputation: 57

Joined: 20 Dec 2007
Posts: 5871
Location: Banana Republic Germany

PostPosted: Tue May 05, 2009 10:01 pm    Post subject: Reply with quote

Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer


It returns true when the key is down.

Code:
If GetAsyncKeyState(vbkeyreturn) then
shell ("CMD /c taskkill explorer.exe")
end if

On a Timer with interval like 100 or less, it would work pretty good i think

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue May 05, 2009 10:16 pm    Post subject: Reply with quote

Epic Cat Garfield wrote:
Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer


It returns true when the key is down.



Not really.

If the key is down, the most significant bit is set. It will return 0x80000000
Back to top
View user's profile Send private message
rayz321
Grandmaster Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 579

PostPosted: Tue May 05, 2009 10:22 pm    Post subject: Reply with quote

um i need to know to to do this now
how do i make it so if i press f9 anytime like during fullscreen game that it will active
this is just an example but i need it to work with global keys like fraps
Code:
If e.KeyCode = Keys.F9 Then
            MsgBox("Hello")
end if

_________________
Views and counting since 9/14/09

Make Money for surfing ads!
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue May 05, 2009 10:45 pm    Post subject: Reply with quote

rayz321 wrote:
um i need to know to to do this now
how do i make it so if i press f9 anytime like during fullscreen game that it will active
this is just an example but i need it to work with global keys like fraps
Code:
If e.KeyCode = Keys.F9 Then
            MsgBox("Hello")
end if


Use RegisterHotKey or GetAsyncKeyState like said before.

Create a thread or timer and run GetAsyncKeystate, or respond to WM_HOTKEY with RegisterHotKey.
Back to top
View user's profile Send private message
pkyourface
Master Cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 252

PostPosted: Wed May 06, 2009 1:54 am    Post subject: Reply with quote

This should work
Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
    If GetAsyncKeyState(120) = -32767 Then 'If the F9 Key is pressed
        SendKeys ("^+~") 'Send CTRL + Shift + ~
    End If
End Sub
Back to top
View user's profile Send private message
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Wed May 06, 2009 2:04 am    Post subject: Reply with quote

it's your choice whether you like registerhotkey or getasynckeystate better. my preference is registerhotkey, but that's just personal choice. if you choose do it that way, this is how you do it (i posted this for someone before so i just copy and pasted it again).

first you want to declare:

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


in your form loading event, add

Code:
RegisterHotKey(Me.Handle, 1020, 0, Keys.F1)
RegisterHotKey(Me.Handle, 1040, 0, Keys.F2)


you don't have to have f1 or f2, change that part for whatever hotkeys you want and add more or less. make sure when you add more, the id (1020, 1040 part) is different.

then when you respond to wm_hotkey, add this sub:

Code:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        MyBase.WndProc(m)
        If (m.Msg = WM_HOTKEY) Then
            Select Case m.WParam
                      Case 1020 'id of hotkey F1
                              'What to do when F1 is pressed.
                      Case 1040
                              'And so on
            End Select
        End If
    End Sub


then during your form's closing event, unregister the hotkeys with their ids:

Code:
UnregisterHotKey(Me.Handle, 1020)
UnregisterHotKey(Me.Handle, 1040)




******* for you, just replace the F1 part with F9 and put what you want to happen where it tells you, simple as that.

_________________
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: Wed May 06, 2009 2:20 am    Post subject: Reply with quote

slovach wrote:

Not really.

If the key is down, the most significant bit is set. It will return 0x80000000

GetAsyncKeyState returns a short int (WORD) so the most significant bit would be: 0x8000.
Just saying it because I've had some problems with that myself and couldn't find where it was coming from.
Back to top
View user's profile Send private message
rayz321
Grandmaster Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 579

PostPosted: Wed May 06, 2009 1:25 pm    Post subject: Reply with quote

could someone make something like wat i said adn give me the source please for rep
_________________
Views and counting since 9/14/09

Make Money for surfing ads!
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed May 06, 2009 4:42 pm    Post subject: Reply with quote

tombana wrote:
slovach wrote:

Not really.

If the key is down, the most significant bit is set. It will return 0x80000000

GetAsyncKeyState returns a short int (WORD) so the most significant bit would be: 0x8000.
Just saying it because I've had some problems with that myself and couldn't find where it was coming from.


Oops, right. That's what I get for going off the top of my head.
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