Results 1 to 9 of 9

Thread: I need a idea

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Post

    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)

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Posts
    81
    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Talking 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)

  4. #4
    Member
    Join Date
    May 2000
    Posts
    45
    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

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Talking 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)

  6. #6
    Member
    Join Date
    May 2000
    Posts
    45
    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

  7. #7
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    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

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: I need a idea

    Have a look at RegisterHotKey

  9. #9
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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
  •  



Click Here to Expand Forum to Full Width