Article View: borland.public.cppbuilder.nativeapi
Article #14949Re: System wide shortcut
From: micheal davis
Date: Wed, 23 Jul 2003 00:21
Date: Wed, 23 Jul 2003 00:21
75 lines
3007 bytes
3007 bytes
Thanks remy, it is working great...
best regards
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f1dce10$1@newsgroups.borland.com...
>
> "micheal davis" <micheal_davis@hotmail.com> wrote in message
> news:3f1dc0e4@newsgroups.borland.com...
>
> > HWND dwnd;
>
> You do not need to use a separate HWND, especially one that you are not
> actually assigning to anything. Just use the form's own HWND itself,
which
> is accessible via the form's Handle property.
>
> > if(RegisterHotKey(dwnd,1, MOD_CONTROL && MOD_ALT, VK_F6)==true)
>
> Use Handle instead of dwnd. Also, you need to use the '|' operator rather
> than '&&':
>
> if( RegisterHotKey(Handle, 1, MOD_CONTROL | MOD_ALT, VK_F6) )
>
> > UnregisterHotKey(dwnd,1);
>
> Here too, use Handle instead:
>
> UnregisterHotKey(Handle, 1);
>
> > //here comes my problem I don't know how and where shall I put the
> WM_HOTKEY
>
> Declare a MESSAGE_MAP for it, or override the inherited WndProc() method:
>
> 1)
> class TForm1 : public TForm
> {
> private:
> void __fastcall WMHotKey(TMessage &Message);
> public:
> BEGIN_MESSAGE_MAP
> VCL_MESSAGE_HANDLER(WM_HOTKEY, TMessage, WMHotKey)
> END_MESSAGE_MAP(TForm)
> };
>
> void __fastcall TForm1::WMHotKey(TMessage &Message)
> {
> if( Message.WParam == 1 )
> // do something
> else
> TForm::Dispatch(&Message);
> }
>
>
> 2)
> class TForm1 : public TForm
> {
> protected:
> void __fastcall WndProc(TMessage &Message);
> };
>
> void __fastcall TForm1::WndProc(TMessage &Message)
> {
> if( (Message.Msg == WM_HOTKEY) && (Message.WParam == 1) )
> // do something
> else
> TForm::WndProc(Message);
> }
>
>
> Gambit
>
>
Technical Details
Message-ID:
<3f1dd526@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f1d3cf2@newsgroups.borland.com> <3f1d62de@newsgroups.borland.com> <3f1dc0e4@newsgroups.borland.com> <3f1dce10$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,b82a70152a2e1a91 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-22 17:24:23 PST From: "micheal davis" <micheal_davis@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f1d3cf2@newsgroups.borland.com> <3f1d62de@newsgroups.borland.com> <3f1dc0e4@newsgroups.borland.com> <3f1dce10$1@newsgroups.borland.com> Subject: Re: System wide shortcut Date: Tue, 22 Jul 2003 16:21:58 -0800 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 212.103.167.63 Message-ID: <3f1dd526@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058919718 212.103.167.63 (22 Jul 2003 17:21:58 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail