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 


[Q] VB 2005 Code

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
TheIndianGuy
Advanced Cheater
Reputation: 102

Joined: 14 Jan 2007
Posts: 88

PostPosted: Mon May 21, 2007 8:07 pm    Post subject: [Q] VB 2005 Code Reply with quote

i wanted to make a script that would allow me to use a combo box to pick any letter or number (A-Z, 0-9) and when you pick the number with the combo box and hit the hotkey F12 it presses that letter/number every 5 seconds could anyone help me? thank you
Back to top
View user's profile Send private message
stimmedcow
How do I cheat?
Reputation: 0

Joined: 21 May 2007
Posts: 5

PostPosted: Mon May 21, 2007 9:43 pm    Post subject: Reply with quote

Here's an outline of what you will want to do:

Create a VB form with the keys you want to be pressed.
When the user selects a key store it in some global variable
Install a system wide keyboard hook
--In the keyboard hook, if F12 is pressed
---Create a timer that will run every so many minutes
-----Use the sendkeys function to press the button
When your program program exits, remove the keyboard hook

I can't paste links so you will need to Google search:
sendkeys vb
timers vb
keyboard hook vb

For the core of your program. sendkeys will send input to the active window, so you will have to additional stuff if you want it on a specific window.
Back to top
View user's profile Send private message
TheIndianGuy
Advanced Cheater
Reputation: 102

Joined: 14 Jan 2007
Posts: 88

PostPosted: Mon May 21, 2007 10:08 pm    Post subject: Reply with quote

ok thanks ill get some info on that right now thanks once again ^_^

if you could put a script or teach me how to make it work for a specific window that would be greatly appreciated.
Back to top
View user's profile Send private message
stimmedcow
How do I cheat?
Reputation: 0

Joined: 21 May 2007
Posts: 5

PostPosted: Mon May 21, 2007 10:28 pm    Post subject: Reply with quote

For a specific window, it's simple if you have only one instance of the window on the screen.

For that, all you have to do is use is - FindWindow

Search for "FindWindow vb" and there are some good examples. All you have to do is pass it the title of the window you want to do, or the class of the title if you know it then it will find the window.

If there are more than one window with the same name that gets more tricky and you have to use FindWindowEx, and loop though all windows. There's probably another way to loop though window handles, but FindWindow is easiest.

Once you have the window handle, you can: call SetForegroundWindow to activate the window and then SendKeys will be called for that window.

However, if you do not want to activate the window and just send key messages, that is a lot trickier and I can't help you with that specifically. It depends on how the game processes your key messages. Thats just messing around with SendMessage a bit : /
Back to top
View user's profile Send private message
TheIndianGuy
Advanced Cheater
Reputation: 102

Joined: 14 Jan 2007
Posts: 88

PostPosted: Tue May 22, 2007 5:09 pm    Post subject: Reply with quote

with a timer by doing Sleep (3000) it will pause for 3 seconds correct? but in .Net when i type that in it says sleep is not declared =/ and same with SendKeys.Send("{ENTER}") it will say Sendkeys is not declared but i rather change the ENTER with F10 but hopefully someone can help me fix

EDIT:
im not so great with "If" and "When" statements but this code isnt working for me you think you could help? it says the word if cannot apear outside the method body? i may be putting the code in the incorrect place which may be causing the problem i am putting this code in the Form which i dont think is the correct spot. i still need to make a timer so it runs every 5 seconds but i made a combo box so you can pick the numbers 0-9 i need to get some code for that so it will know that you have chosen the number. But here is my code so far please fix =D

Public Class Form1
'write the code in key press event
'when press F10 key it act as number 5
If e.keycode=keys.F10 then sendkeys.send("{5]")
End Class

Its saying the "If" is incorrect oh i have to do an end if i think

ANOTHER EDIT:
could i do Timer1.Interval=5000 to make it hit 5 every 5 seconds but i know there is more to this script to make it actually hit the number 5 besides for doing Timer1.Interval=5000 help please
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