Help with Vb 2008 (Hotkeys)

Posts 1–15 of 18 · Page 1 of 2
Help with Vb 2008 (Hotkeys)
Hello, i need help with my Vb 2008
im making hotkeys for my new program but im stuck... Because im going to make so button1 and button2 clicks with f1 and f2 but it don't seems to work please help me
button1_click(sender,e)
Quote Originally Posted by Blubb1337 View Post
button1_click(sender,e)
still not working
Quote Originally Posted by NGT.Rock View Post
still not working
Okay this works for me:

Use this import (add it above "Public Class Form1")
[php]
Imports System.Runtime.InteropServices
[/php]

Then remove your current "GetAsyncKeyState" declaration and add this

[php]
<DllImport("user32.dll")> _
Private Shared Function GetAsyncKeyState(ByVal vKey As Integer) As UShort
End Function
[/php]

Then change your hotkey timer code to this:

[php]
dim hotkey1, hotkey2 as boolean

hotkey1 = GetAsyncKeyState(Keys.F1)
hotkey2 = GetAsyncKeyState(Keys.F2)

if hotkey1 = True then

Button1_Click(sender, e)

Else if hotkey2 = True then

Button2_Click(sender, e)

End if

[/php]
declare:

Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Int32) As Int16
on hotkey tick
Code:
dim f1 as boolean = getasynckeystate(keys.f1)
dim f2 as boolean = getasynckeystate(keys.f2)

if f1 then
button1_click(sender,e)
end if

if f2 then
button2_click(sender,e)
end if
Quote Originally Posted by Blubb1337 View Post
declare:

Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Int32) As Int16
on hotkey tick
Code:
dim f1 as boolean = getasynckeystate(keys.f1)
dim f2 as boolean = getasynckeystate(keys.f2)

if f1 then
button1_click(sender,e)
end if

if f2 then
button2_click(sender,e)
end if
thank's it works now . BUT i have still one problem, when i open combat armsand click F2 Combat arms auto minimize and the program pops up and internet turn's off then i need to go back to combat arms and do it and same is when i turn it off.

so my question is how can i fix so it runs in the backround without minimize combat arms when clicking f1 or f2
Quote Originally Posted by NGT.Rock View Post
thank's it works now . BUT i have still one problem, when i open combat armsand click F2 Combat arms auto minimize and the program pops up and internet turn's off then i need to go back to combat arms and do it and same is when i turn it off.

so my question is how can i fix so it runs in the backround without minimize combat arms when clicking f1 or f2
Button 1's and Button 2's code will help better !!
im guess

[php]

Shell("NET START DHCP")

[/php]

and

[php]

Shell("NET STOP PHP")


[/php]
Quote Originally Posted by Hassan View Post
Button 1's and Button 2's code will help better !!
But i mean ingame!
dudes people want hotkeys so it will be easier to use it ingame. So u don't need to minimize and then click Start / stop
Quote Originally Posted by NGT.Rock View Post
But i mean ingame!
dudes people want hotkeys so it will be easier to use it ingame. So u don't need to minimize and then click Start / stop
We are not choobs...We know but we need to see the code of button1 and button 2 to see what's causing the game to lose focus !!!
Quote Originally Posted by Hassan View Post
We are not choobs...We know but we need to see the code of button1 and button 2 to see what's causing the game to lose focus !!!
the code for button 1 and button 2 is
Button 1 = Shell ("net start dhcp")
Button 2 = Shell ("net stop dhcp")
Post your button1/button2 events codes.
why dont you just put it on your timer instead of using buttons.
Quote Originally Posted by Blubb1337 View Post
why dont you just put it on your timer instead of using buttons.
so u can choose btw both , and i don't know how to change it to timer only
Ever thought about simply replacing button1_click(sender,e) with the shell command?
Posts 1–15 of 18 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us