Board index » delphi » Keyboard event

Keyboard event

Hi to all:
        I would like to know if "keyb_event" can generate (and how) key
combinations like Alt+F4.
        Thanks in advance.

 

Re:Keyboard event


Hi to all,
        I will answer myself after a try-error-try...-success process. To press a
virtual key with Alt, Ctrl or Shift try the next source code:

type
        (...)
        DoubleTecla = (None,Alt,Ctrl,Shift);

begin
        (...)
        Case DoubleTecla of
         Alt : keybd_event(VK_CONTROL,0,0,0);
         Ctrl : keybd_event(VK_MENU,0,0,0);
         Shift : keybd_event(VK_SHIFT,0,0,0);
        end;

        keybd_event(VK_KEY,0,0,0);
        keybd_event(VK_KEY,0,KEYEVENTF_KEYUP,0);

        Case DoubleTecla of
         Alt : keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
         Ctrl : keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
         Shift : keybd_event(VK_SHIFT,0,KEYEVENTF_KEYUP,0);
        end;
end;

Moises Cambra <412...@ingtz.unizar.es> escribi en artculo
<01bcb33f$5e8f6a60$LocalH...@m.unizar.es>...

Quote
> Hi to all:
>    I would like to know if "keyb_event" can generate (and how) key
> combinations like Alt+F4.
>    Thanks in advance.

Other Threads