Article View: borland.public.cppbuilder.nativeapi
Article #4077Re: Passing key presses on to another form
From: Bruce Larrabee
Date: Sun, 26 Mar 2006 21:12
Date: Sun, 26 Mar 2006 21:12
38 lines
2004 bytes
2004 bytes
Bob Gonder wrote:
> Anders Johansen wrote:
>
>
>>I want keyboard key presses
>>(not mouse key events) to be passed on to the main form. I know which
>>control on the main form to give focus, and how to do it, but the catching,
>>screening and then passing on of the keyboard events eludes me.
>>
>>Any easy solutions?
>
>
> Look at SetWindowsHookEx()
>
> If you have trouble with it, Google "borland SetWindowsHook"
> Remy has posted code and advise several times on this.
>
>
How about writing a function in the main form and using it from the toolbar
to pass any keys 'intercepted' by the toolbar?
void __fastcall TMainForm::InterceptedKeys( char &Key)
{
// route 'Key' to whatever normally handles key strokes...
}
void __fastcall TTlBar::FormKeyPress(TObject *Sender, char &Key)
{
MainForm->InterceptedKeys( char &Key);
}
Laters,
Bruce Larrabee
Technical Details
Message-ID:
<442703f3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4426b7b7$1@newsgroups.borland.com> <v9kd229pnqv0clgsi0al21rcp42c4k620t@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2f0c7fdce41e2cf X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Sun, 26 Mar 2006 13:12:51 -0800 From: Bruce Larrabee <bruce_l@westbrookent.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Passing key presses on to another form References: <4426b7b7$1@newsgroups.borland.com> <v9kd229pnqv0clgsi0al21rcp42c4k620t@4ax.com> In-Reply-To: <v9kd229pnqv0clgsi0al21rcp42c4k620t@4ax.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 64.28.54.48 Message-ID: <442703f3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1143407603 64.28.54.48 (26 Mar 2006 13:13:23 -0700) Lines: 38 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail