Red faceHelpFixing Legacy VB Code

Posts 1–8 of 8 · Page 1 of 1
Fixing Legacy VB Code
Hello! , Am a little new in visual basic, so i dont really know what am doing in first place. I usually focuse my activity on Drawing throught photoshop, but this program called visual basic caught my attention, beacouse its a programming lenguaje and the things you can do with it are almost unlimited.
So i wanted to learn more and more about it, but i dont really understand a word and i need to do this how fast i can, so i request for your help guys, beacause this is not my department hahaha.

My goals:
- I did put 2 command buttoms and 1 timmer on my Form, What i want to do? I want that my 1st command buttom change its propiety to enabled with a simple key pressing (For ex: I press in my keybord SUPR, and then Inside the game it start to spamm the key U until i press the Insert key)

Code:
Option Explicit
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
SendKeys ("u")
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
If Hotkey = 65 Then Timer1.Enabled = True                           ' I know 65 is not SUPR key, its A key      
If Hotkey = 66 Then Timer1.Enabled = False                          ' I know 66 is not Instert key, its S key
End Sub
I done this, but it wont work! , Can you guys modify it By remplacing the Sendkeys for virtualkeys and make it work?

-Goal Number 2:

Okay, i want to fully explain the functions i want to make for this:
I want that when you press configuration mode, it does Auto-Save the positions of the mouse by pressing F1 (by repeating this process 4 times), and when we finish of configurating this possitions i want to Auto-Click that 4 positions when i press the 0 buttom.
and also i was thinking on adding the same feature by repeating Configuration mode steps (1,2,3) and add another 4 possition to bind to key pad 1 key.

-Last goal, the most easly:
How can i make that my timmers that i think they will be atleast 4 timmers,read the intervals i wrote? Like i explain in the image.


THANKS FOR ALL MPGH community!!!

Hope next time i could make a realease in place to request for your help!!
Are you trying to code in Visual Basic 6?

Quit now, move on to VB.Net.
Quote Originally Posted by Blubb1337 View Post
Are you trying to code in Visual Basic 6?

Quit now, move on to VB.Net.
Thank you for the advice!
Kevin (@Blubb1337) said it right, VB6 and < has some benefits, but moving forward you may want to start dev(ing) in VS.net. Your going to have to relearn some things & learn some new things, but it's worth the time it takes.

@yuto

Edit: But, in the mean time, the issue is most likely that your form doesn't have proper focus, The Keypress Event for form will only work if it has no enabled controls (like your buttons) If it does, the buttons will grab focus and if that is the case the keypress event will never fire, Try Setting the KeyPreview Property for the form = true, By doing so the form will receive keystrokes before the controls do.

Hope it helps

Quote Originally Posted by NextGen1 View Post
Kevin (@Blubb1337) said it right, VB6 and < has some benefits, but moving forward you may want to start dev(ing) in VS.net. Your going to have to relearn some things & learn some new things, but it's worth the time it takes.

@yuto

Edit: But, in the mean time, the issue is most likely that your form doesn't have proper focus, The Keypress Event for form will only work if it has no enabled controls (like your buttons) If it does, the buttons will grab focus and if that is the case the keypress event will never fire, Try Setting the KeyPreview Property for the form = true, By doing so the form will receive keystrokes before the controls do.

Hope it helps

where.the.fuck.do.you.come.from?

Quote Originally Posted by Blubb1337 View Post
where.the.fuck.do.you.come.from?

@Blubb1337

Well see, along time a go, My mother & father *(&#$&(* #$(* , well you know.

Seriously, I stop by every now and then, but decided to post today. Don't know why, felt "compelled"
doesnt the op need to define the sendkeys?
and hook it to anouther program/proccess?
Quote Originally Posted by utherson601 View Post
doesnt the op need to define the sendkeys?
and hook it to anouther program/proccess?
Depends on what he is attempting to do, in this case, (as far as we know) his application is functional, In this particular case, he created a HotKey and has no need to hook anything, his project is already checking for keystrokes, he just needs to make sure the form catches the keystroke before the controls do (as answered above)
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?