views:

475

answers:

1

Hi! I was looking around and google this two subjects for hours...couldn't find an explanation about those function\classes, just how it works and what is it actually, i can't just copy paste to my program without understand exactly how it works. I want to make a key to get focused on my app Form(when it minimized) and then focus on a Textbox, so from what i've read i need to use RegisterHotKeys function(that a better solution for my needs), but i didn't found how or where i can choose my own key(only one key - ESC) and then command it to focus on my form and then on the textbox.

Thanks A Lot In Advance!! Amit.

A: 

Sample on how to use hot keys.

class myform : Form
{
    public myform()
    {
        RegisterHotKey(Handle, id, modifiers, mykey);
    }
    protected override void WndProc(ref Message m)
    {
        if (m.Msg == 0x312) // this is WM_HOTKEY
        {
            Show();
        }
        base.WndProc(ref m);
    }
}
Andrew Keith
Thanks a lot!btw what key is 0X312 ? Thanks!Amit
Mazki516
0x312 is not a key, its the WM_HOTKEY message. the key is the virtual key codes which you register with RegisterHotKey.http://msdn.microsoft.com/en-us/library/ms927178.aspx
Andrew Keith
Andrew hi, thank you very much. but, i didn't "got there yet",RegisterHoyKey(Handle, id???, modifiers, mykey??)I've a barcode reader, i configured it to "press" the ESC key, then send the barcode and then "press" enter.i want my program to identify the ESC "Press" and then show the form and then focused on a textbox(these two commands i know how to do it), there is a way to register a hoy key without a modifier(Null is good?)you gave me that great page, but i don't know what to write in id and in mykey, the function ask for int(uint?)Thanks a lot in advance!!Amit
Mazki516