Thread View: borland.public.delphi.nativeapi.win32
6 messages
6 total messages
Started by Sanyin
Thu, 03 Jul 2008 11:29
How to emulate keyboard
Author: Sanyin
Date: Thu, 03 Jul 2008 11:29
Date: Thu, 03 Jul 2008 11:29
5 lines
1071 bytes
1071 bytes
I am trying to make software keyboard. Everything is fine, but how to keep focus while typing? E.g. when typing into web browser control, how to keep focus there when user clicks some key? Key press is emulated using SendInput WinAPI.
Re: How to emulate keyboard
Author: Remy Lebeau (TeamB)
Date: Thu, 03 Jul 2008 17:54
Date: Thu, 03 Jul 2008 17:54
18 lines
1548 bytes
1548 bytes
"Sanyin" <prevodilac@hotmail.com> wrote in message news:486cb803@newsgroups.borland.com... > I am trying to make software keyboard. Why not just use the one that is build into Windows? Have a look at "osk.exe". > Everything is fine, but how to keep focus while typing? Have your form intercept the WM_MOUSEACTIVATE message and return MA_NOACTIVATE. The click will still be processed, but the form will not receive focus. The downside, though, is that the previously focused window still loses its focus. I do not know how osk.exe prevents that. Gambit
Re: How to emulate keyboard
Author: Peter Below (TeamB)
Date: Thu, 03 Jul 2008 18:07
Date: Thu, 03 Jul 2008 18:07
17 lines
1385 bytes
1385 bytes
Sanyin wrote: > I am trying to make software keyboard. > Everything is fine, but how to keep focus while typing? > E.g. when typing into web browser control, how to keep focus there > when user clicks some key? > Key press is emulated using SendInput WinAPI. Example for virtual keypad http://cc.codegear.com/item/18590 -- Peter Below (TeamB) Don't be a vampire (http://slash7.com/pages/vampires), use the newsgroup archives : http://www.tamaracka.com/search.htm http://groups.google.com
Re: How to emulate keyboard
Author: Remy Lebeau (TeamB)
Date: Thu, 03 Jul 2008 22:29
Date: Thu, 03 Jul 2008 22:29
41 lines
2234 bytes
2234 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:486d12b0$1@newsgroups.borland.com...
> The downside, though, is that the previously focused window still
> loses its focus. I do not know how osk.exe prevents that.
Nevermind, I see how now, the WS_EX_NOACTIVATE window style.
The following works for me now:
TForm1 = class(TForm)
published
SpeedButton1: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
private
procedure WMMouseActivate(TMessage &Message); message
WM_MOUSEACTIVATE;
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
procedure TForm1.WMMouseActivate(var Message: TMessage);
begin
Message.Result := MA_NOACTIVATE;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
keybd_event(Ord('A'), 0, 0, 0);
keybd_event(Ord('A'), 0, KEYEVENTF_KEYUP, 0);
end;
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.ExStyle := Params.ExStyle or WS_EX_NOACTIVATE;
end;
Gambit
Re: How to emulate keyboard
Author: Sanyin
Date: Mon, 14 Jul 2008 07:09
Date: Mon, 14 Jul 2008 07:09
15 lines
1454 bytes
1454 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:486d12b0$1@newsgroups.borland.com... > > "Sanyin" <prevodilac@hotmail.com> wrote in message > news:486cb803@newsgroups.borland.com... > >> I am trying to make software keyboard. > > Why not just use the one that is build into Windows? Have a look at > "osk.exe". > Application needs to work with other applications-like osk.exe. Osk is fine, but I need own component. I suppose answer is some API hooking, right?
Re: How to emulate keyboard
Author: Yannis
Date: Mon, 14 Jul 2008 14:14
Date: Mon, 14 Jul 2008 14:14
15 lines
1149 bytes
1149 bytes
Sanyin wrote: > Application needs to work with other applications-like osk.exe. > Osk is fine, but I need own component. > I suppose answer is some API hooking, right? No. API Messaging is the answer NOT hooking. You need to take a closer look on how the keyboard events are handled by the os it self and replicate it in your application. regards Yannis. --
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads