I have a Console App (VB.Net) that runs as it is supposed to with error handling and a few user inputs along the way.
The App is very basic - could be "Hello World" for testing purposes.
I'd like to have a hotkey to run this app with that would automatically jump to either a GOTO statement or Sub if the key is being pressed while the .exe is being launched.
Is this possible? I am having difficulties doing so.
Solved! Go to Solution.
Maybe this info will sort your problem.
1. Right click on the application, what you want to assign a keyboard shortcut key.
2. click on create Shortcut, move that shortcut to anywhere.
3. Now right click on the shortcut, go to properties, select the shortcut zone and then press any key to assign.
This will work with Ctrl+Alt+key or Ctrl+Shift+key.
Thanks & Regards
Events in a console app?
I think you could add a Form and hide it while it 'hopefully' still listens to events.
Here are a few discussions I found online:
and here's one on code-project:
and a simpler technique from DotNet Pearls:
THx all, I found my issue!!!
I did not have a stopping point (Console.ReadKey(True)) in my test... so it was appearing as it did not work, where indeed it had.
here was my test this morning... and when i went back to check my real code i noted i did not have the wait points (Console.ReadKey(True))
Module Module1 Sub Main() ''Check for Key Press, If So GoTo _AutoRun If My.Computer.Keyboard.CtrlKeyDown = True Then 'IsKeyDown(Key.Ctrl) Then AutoRun() End If 'this would be the main body of code, prior to wanting to add the bypass Console.Title = "ISKeyDownTest - FALSE" Console.BackgroundColor = ConsoleColor.White Console.ForegroundColor = ConsoleColor.Black Console.Clear() Console.Beep(1500, 250) Console.WriteLine("Ctrl Key is NOT Down") Console.ReadKey(True) End Sub Sub AutoRun() 'this would be calls only with no error handling. Console.Title = "ISKeyDownTest - TRUE" Console.BackgroundColor = ConsoleColor.Red Console.ForegroundColor = ConsoleColor.White Console.Clear() Console.Beep(1500, 250) Console.WriteLine("Ctrl KEY is DOWN!!!") Console.ReadKey(True) End Sub End Module