Board index » cppbuilder » Hiding App. / System Tray...

Hiding App. / System Tray...

Hi.

I am trying to get my app. to minimize to the system tray.

Right now, everything seems to be working OK except
that when I press the minimize button the first time it hides
the application as it should.  Then when I click on the icon
in the system tray it shows like it should.  However, when
I click on the minimize button again nothing happens it
seems as if the OnMinimize handler disappears after the
first time it is minimized.

Here is a short rundown of what I have done:

void __fastcall TMainForm:: OnCreate() {
    Application->OnMinimize = OnMinimizeHandler;

Quote
}

void __fastcall TMainForm::WndProc(Messages::TMessage &Message) {
    if(Message.Msg == IconMessage) {
        if(Message.LParam == WM_LBUTTONDBLCLK) {
            WindowState = wsNormal;
            Show();
        }
        return;
    }
    TForm::WndProc(Message);

Quote
}

void __fastcall TMainForm :: OnMinimizeHandler(TObject *Sender) {
    // ShowWindow(Application->Handle, SW_HIDE);
    Hide();
    Visible = false;

Quote
}

It all looks good to me.  Did I overlook something?

-Art

 

Re:Hiding App. / System Tray...


Ha. I don't believe it. I managed to nab a question before the others :0

Have a look at http://www.bcbdev.com/faqs/faq73.htm

That will explain how it is done, and comes complete with code examples.

J

--

?,++,??,++,?*
....Jason C. Leach
..."Many Hands Make Light Work."
..- Unknown

-- PGP key on server: pgpkeys.mit.edu

Re:Hiding App. / System Tray...


Quote
Jason C. Leach wrote:
> Ha. I don't believe it. I managed to nab a question before the others :0

> Have a look at http://www.bcbdev.com/faqs/faq73.htm

> That will explain how it is done, and comes complete with code examples.

Jason:

Thanks for pointing me to the FAQ, it is quite well done.  However, I don't
see why my on minimize handler (which simply calls Hide()) works the first
time but doesn't work any time after that.  If I can get that part to work,
the
whole run from tray thing will be working perfectly.

-Art

Re:Hiding App. / System Tray...


Quote
>> Have a look at http://www.bcbdev.com/faqs/faq73.htm

>Thanks for pointing me to the FAQ, it is quite well done.  However, I don't
>see why my on minimize handler (which simply calls Hide()) works the first
>time but doesn't work any time after that.  If I can get that part to work,
>the
>whole run from tray thing will be working perfectly.

Any chance you can do me a favor. Download the example project, then one
that claims to minimize to the system tray, and run it. Does it have the
same flaw? If not, then do what it does. <G> If it does, then let me know so
I can find out what the problem is.

Harold Howe [TeamB]
http://www.bcbdev.com

Re:Hiding App. / System Tray...


Both examples from the FAQ work fine.  They minimize and open with no
problem.  I sat there for 7 hours minimizing and opening it just to be
sure :) Just kidding, I should have saved that until April 1.

--

?,++,??,++,?*
....Jason C. Leach
..."Many Hands Make Light Work."
..- Unknown

-- PGP key on server: pgpkeys.mit.edu

Re:Hiding App. / System Tray...


Quote
On Wed, 24 Mar 1999 16:58:44 -0700, Art Pollard <Polla...@Lextek.com> wrote:

>Hi.

>I am trying to get my app. to minimize to the system tray.

>Right now, everything seems to be working OK except
>that when I press the minimize button the first time it hides
>the application as it should.  Then when I click on the icon
>in the system tray it shows like it should.  However, when
>I click on the minimize button again nothing happens it
>seems as if the OnMinimize handler disappears after the
>first time it is minimized.

I had the same thing. when you wake up the app you have to do it the same way -
doubleclick & menu command...

Other Threads