🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12083

Re: Register windows hotkey problem

#12083
From: Martin C
Date: Thu, 25 Dec 2003 12:14
60 lines
3069 bytes
Santa,

Thank you so much for your reply, actually I wasn't looking to activate the
window that is minimized in the system tray. My problem was after
successfully registering the hotkey using the RegisterHotKey function.
You see for example let's say I made a hotkey ALT+F1 so whenever the user
press this hotkey my program will ShowMessage("1"); . Now as long as the
windows which was registered with the hotkey was open (active) then there is
no problem at all, and whenever the user press ALT+F1 the message appear,
now if I minimized this form to the system tray, sometime the message show
and sometimes not when pressing the hotkey !
So what I really need to know how to overcome this problem on the
("Minimized window")  .

Thank you so much for your help and Happy Holidays....



"Santa" <north@pole.com> wrote in message
news:3fea54ef@newsgroups.borland.com...
>
> "Martin C" <martinc@aol.com> wrote:
> > I am trying to register windows hotkey using the following code
> >
> >    RegisterHotKey(Handle, 1, MOD_ALT, VK_F1);
>
> According to the win32.hlp file, you can set up a global hot key
> or a thread-specific hot key. "...A global hot key is associated
> with a particular window; it allows the user to activate the window from
any part of the system....".
>
> RegisterHotKey is thread specific. Try setting a global hotkey
> by using the WM_SETHOTKEY message. "...The window specified in
> WM_SETHOTKEY receives a WM_SYSCOMMAND message that specifies
> the SC_HOTKEY value. This message activates the window that
> receives it....". Be sure to read the remarks.
>
> You'll also need to subclass the forms WndProd method:
>
> //-- in the header
> protected: // User declarations
>     virtual void __fastcall WndProc(TMessage &Message);
>
> //-- in the unit
> void __fastcall TForm1::WndProc(TMessage &Message)
> {
>     if( Message.Msg == WM_SYSCOMMAND )
>       {
>           if( Message.wParam == SC_HOTKEY )
>             {
>                 // You're on your own now
>             }
>       }
>       TForm::WndProc(Message);
> }
>
> Good Luck and Happy Holidays
>
> Santa
>
Technical Details
Message-ID: <3fead520@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fea38e8$1@newsgroups.borland.com> <3fea54ef@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,fd964279e0f05daa
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-25 04:39:12 PST
From: "Martin C" <martinc@aol.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References:  <3fea38e8$1@newsgroups.borland.com> <3fea54ef@newsgroups.borland.com>
Subject: Re: Register windows hotkey problem
Date: Thu, 25 Dec 2003 14:14:59 +0200
Lines: 62
Organization: V Safe
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: 62.135.27.164
Message-ID: <3fead520@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1072354592 62.135.27.164 (25 Dec 2003 04:16:32 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail