Link to home
Start Free TrialLog in
Avatar of Richard
RichardFlag for United States of America

asked on

VB6 key press at program start

Using VB6, I'm trying to detect if a couple of keys are pressed at the time the icon to start the program is clicked.  I need to detect if a particular key combination is pressed before any forms are displayed, so I can't use something like form.keypress (no form loaded yet).
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

This is somewhat a strange question....i guess that the application starts...performs some "work" and then it shows...
May something like this :http://www.vbforums.com/showthread.php?27616-Recoginition-of-keypress-thru-API(Window-API) could help but i am not sure
Avatar of Richard

ASKER

Hi John,
Thanks for the quick reply.  I have seen programs which if started (clicking the icon) with a particular key held down (when the icon is clicked) sets a debug mode or changes the logging mode of the program.  In my case, what I want to do is to change the behavior of a routine which connects to a SQL server.  If the server is off (and proper key not pressed) a message is shown that the server is off and the program terminates.  If a key is pressed, and the server is off, the user is prompted to change to a different server.  I'm trying to make it as difficult as possible for a user to change to a different server.
Interesting thinking....how about loading a small hidden form that watches for the key and then proceed...
I found a post about running a process in memory but its a bit of a hack : http://www.vbforums.com/showthread.php?728585-How-do-I-execute-a-program-from-memory
ASKER CERTIFIED SOLUTION
Avatar of Richard
Richard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial