Try looking for WM_KEYDOWN in your application message handler.
Good luck.
Kurt
type
TForm1 = class(TForm)
Edit1: TEdit; Edit2: TEdit; Label1: TLabel;
procedure FormCreate(Sender: TObject);
file://Application.OnMessage intercept
procedure AppMessage(var Msg: TMsg; var Handled: Boolean); file://From
Delphi Help example, but nothing caught
procedure GenerateOnKeyDown(var Message: TMessage); message WM_KEYDOWN;
file://Nothing caught
procedure WndProc(var Message: TMessage); override; file://Only mouse
events caught!
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WndProc;
begin
if (Message.Msg = WM_KEYUP) or (Message.Msg = WM_CHAR) then
label1.caption:='WM_KEYUP in WndProc' file://NOTHING
else
if Message.Msg = WM_MOUSEMOVE then
label1.caption:='mouse' file://IT CATCHES MOUSE EVENTS OK
else
inherited WndProc(Message);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;
procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
edit2.text := 'in appmsg'; file://IT NEVER EVEN GETS HERE
if (Msg.message = WM_IME_KEYDOWN) or (Msg.message = WM_KEYUP) then
begin
case (Msg.wParam) of file://SO IT COULDN"T GET HERE
VK_TAB : begin Edit1.Text := 'Tab';
SelectNext(Sender As TWinControl, False, True);
Handled := True;
end;
end;
end;
procedure TForm1.GenerateOnKeyDown(var Message: TMessage);
begin
edit1.text:= 'in keydn'; file://NOTHING
end;
end.
Application.OnMessage will work, but you should look for
WM_KEYDOWN/WM_SYSKEYSDOWN messages. The handler will see WM_KEYUP/WM_SYSKEYUP,
however. If the event handler is not called then you have something in your
app that disconnects it again after your statement in the forms OnCreate
handler. Do you have a TApplicationEvents object on any of your forms. Even if
not, do you have the AppEvnts unit in any of your uses clauses? If so, try to
remove it.
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
>procedure TForm1.WndProc;
>begin
> if (Message.Msg = WM_KEYUP) or (Message.Msg = WM_CHAR) then
> label1.caption:='WM_KEYUP in WndProc' file://NOTHING
> else
> if Message.Msg = WM_MOUSEMOVE then
> label1.caption:='mouse' file://IT CATCHES MOUSE EVENTS OK
> else
> inherited WndProc(Message);
>end;
If you EITHER always put whitespace after "//", OR get yourself
respectable News software, then we will not be afflicted with those
unwanted "file:" and my newsreader will not display them as URLs.
--
© John Stockton, Surrey, UK. j...@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL: http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Plaintext, quoting : see <URL: http://www.usenet.org.uk/ukpost.html>
Do not Mail News to me. Before a reply, quote with ">" or "> " (SoRFC1036)