|
-
May 22nd, 2000, 08:48 PM
#1
Thread Starter
Hyperactive Member
Ok i got my proggie setup to where you key down a certain combination form4.visible = true. Now the bad thing is you have to be focused on the form, textbox, command button or where else I placed the command for this hotkey to work. But if I want this hotkey to work ALL the time, how would I go about that?
-RaY
VB .Net 2010 (Ultimate)
-
May 22nd, 2000, 08:53 PM
#2
Lively Member
How about having a function called something like "ProcessKeyEvent" that takes all the same args as the sub your code is in at the moment? That way you can add a one-liner to whichever controls (textboxes/form/etc) you want the hotkey to work from.
Toot
Some cause happiness wherever they go; others, whenever they go.
-
May 22nd, 2000, 09:02 PM
#3
Thread Starter
Hyperactive Member
Would that work guys, i need more opinions
Would that work? And if that would work, how would i go about doing this. I got VB3 and I feel most the code around doesn't work which brings me to this mini question inside the question hehe.
It has come to my understand that public constant, doesn't work for vb3.....is it ok if i replace public to global....would i get the same affect? Don't forget my other question to guys hehehe.
-RaY
VB .Net 2010 (Ultimate)
-
May 22nd, 2000, 10:20 PM
#4
Member
If you want a hot-key global to the form you need to set the forms 'KeyPreview' property to true. This will cause all key presses that occur when that form is active to be passed to the *forms* keypress/keydown/keyup events. Once processed by the form, if it's a keypress, it will be passed to the control that has focus.
If you don't want this to happen, in the keypress event set KeyASCII to 0 in the forms event. In the keyDown set keyCode to 0.
Check out http://msdn.microsoft.com/library/de...keypreview.htm for more details
K
----------------------------------
VB6 Ent SP4 Win2K Pro Platform SDK
-
May 22nd, 2000, 10:35 PM
#5
Thread Starter
Hyperactive Member
Thanks kleve
Thanks for the reply kleve, I understand what your saying...thats basically what I have....the problem i have is that when the program looses focus the hot key doesnt work...how do I keep it focused at all times...zorder doesnt seem to help any because it only keeps that form on top of other forms...for example if someone was to open internet explorer....it will over lap my form and hot keys will no longer work......keep the suggestions coming guys...
-RaY
VB .Net 2010 (Ultimate)
-
May 22nd, 2000, 11:31 PM
#6
Member
you're talking about a global hotkey for windows? Sorry, I don't think MS let you assign them as you wish 
As a wild idea, you CAN set a limited collection of hotkeys to run programs. If you could live with that then you could spawn a program that tried to get the window handle of your program and send a key to it, then die. Or use some message passing method. Bar that I'm not sure it's possible - anyone any ideas?
K
----------------------------------
VB6 Ent SP4 Win2K Pro Platform SDK
-
Sep 29th, 2006, 09:41 AM
#7
Hyperactive Member
Re: I need a idea
this might not work but i have an idea for you,
If the hotkeys you are setting are in a vb program you can load the program at startup by putting it in the startup folder
in the form load of your code add:
form4.show, vbhide
change the properties so that the prog dosent show in the taskbar and maximise it.
the form wont show but it should work because ive used this method to disable alt+f4
may be you could enter the code to make the form the upmost form, even though it wouldnt show it would still be made as the upmost form.
chris1990
-
Sep 29th, 2006, 09:55 AM
#8
Re: I need a idea
Have a look at RegisterHotKey
-
Sep 29th, 2006, 10:01 AM
#9
Re: I need a idea
i wonder if he's still looking for an answer after 6 years
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|