Hack Forums
[.NET] [vb.net] make simple program which enables something in program - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [vb.net] make simple program which enables something in program (/showthread.php?tid=903595)

Pages: Pages 1 2


[vb.net] make simple program which enables something in program - skxprive - Dec 17, 2010

Hey
Ive got a program which enables and disables a rule (connection rule).

Don't know how to make in vb.net a program which disables the rule without clicking on it; because now: right mouse and click on "disable rule"
or after it click "enable rule"
When I click on hotkey on keyboard, and the program enables/disables it , it would be better

Btw program is softperfect bandwidth manager


* - Deceptive - Dec 17, 2010

You're making no sense, please explain in detail with correct grammar so I can understand at least one thing in your post.


* - m_t_h - Dec 17, 2010

what on earth r u talking about


* - skxprive - Dec 17, 2010

(Dec 17, 2010 10:45 AM)TheMist Wrote:  You're making no sense, please explain in detail with correct grammar so I can understand at least one thing in your post.

Look in that program, I made a connection rule.
I can use rightmouse and after click on the "menu": "enable rule"
or when it is enabled: "disable rule"

But I don't want to click on it, but want wit a keyboard hotkey for example "g"-hotkey.
The problem is how to do this, that it enables it with that hotkey.


* - m_t_h - Dec 17, 2010

what connection rule? -.-
oh you want hotkeys...

go on youtube and search for: "hotkeys in vb"

:)


* - skxprive - Dec 17, 2010

Yes hotkeys is no problem, But the problem is how to do the action: "Enable Rule"
the rule is just about download/uploadspeed.


* - The-One - Dec 17, 2010

Are you talking about a plugin system?


* - skxprive - Dec 17, 2010

(Dec 17, 2010 11:16 AM)The-One Wrote:  Are you talking about a plugin system?

Don't know,

When using the hotkey, it should enable rule

But normally to enable rule: You should click-right on it and after choose enable rule of the list


* - Pulser - Dec 17, 2010

You want to enable something with a hotkey?
Code
if(E.Keycode == Keys.G)
{
  Someshit.Enabled = true;
}



* - #cn - Dec 17, 2010

He wants to make a program so that when he presses a hotkey, it edits the setting for another program and vice versa.

I would help you OP but I have no idea on how to do this :/ Sorry


* - TraptCode - Dec 17, 2010

Ok, so you need to start off by finding the window class type. Spy++ will do that for you.
Second, you want to declare your APIs.

Code
Private Declare Function FindWindowExA lib "user32" (ByVal Parent as intptr, ByVal ChildAfter as intptr, Byval Classname as String, ByVal WindowText as String) as IntPt
Private Declare Function FindWindowA lib "user32" (ByVal Classname as String, ByVal WindowText as String) as Intptr
Private Declare Function SendMessageA lib "user32" (ByVal hwnd as IntPtr, Byval Message as Integer, ByVal WParam as Integer, Byval lParam as String) as Integer
Private Declare Function GetAsyncKeyState lib "user32" (ByVal Hotkey as Integer) as Integer
Dim ToggleBoolean as Boolean = False

Now in a timer, with the interval set to 1, you want to do this.

Code
Public Sub Timer_Tick
Dim Hotkey as Boolean
Hotkey = GetAsyncKeyState(Keys.F12) 'You can change f12 to whatever
If Hotkey = True then
If Toggle = True Then
Dim Hwnd as Integer
Dim Child as Integer
FindWindowA("TheClassNameYouFound", vbnullstring)
'Using SendMessage, find a message to work with context menus.
Toggle = False
End If
Else
Toggle = True
End If
End Sub



* - skxprive - Dec 17, 2010

(Dec 17, 2010 12:11 PM)TraptCode Wrote:  Ok, so you need to start off by finding the window class type. Spy++ will do that for you.
Second, you want to declare your APIs.

Thanks very much now I will try it with Spy


* - TraptCode - Dec 17, 2010

Here is a list I uploaded for you, this has a huge amount of values you can try sendmessage with.

http://ha.zard0.us/_/showthread.php?162-A-huge-list-of-SendMessage-Values&p=206


* - skxprive - Dec 21, 2010

Trapcode tried to help me, it is not working, because its not a direct checkbox, but a "rightclick, after click on a menu"

So Maybe another solution: Putting the program on: But deactivated it somehow .. and when needed activate it with a hotlink
Don't know if this is possible


* - Ag3nt - Dec 21, 2010

Store the programs settings in a text file, edit the text file.