🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Move program into the system tray with SetWindowLong

#12038
From: Jan Weingärtner
Date: Tue, 30 Dec 2003 20:43
35 lines
2266 bytes
Hi.

>     Hide the application's taskbar icon
>     http://www.bcbdev.com/faqs/faq4.htm
> 
>     Start a program hidden
>     http://www.bcbdev.com/faqs/faq6.htm
> 
>     Create forms that miminize or close to the system tray
>     http://www.bcbdev.com/faqs/faq73.htm

I have already used these sources.
My impression is, that all this code is only working on creation
of the form and not at runtime. It seems to be impossible to switch 
between task bar mode and system tray mode at runtime.

If i execute this in OnCreate:

SetWindowLong(Application->Handle, GWL_EXSTYLE,
      (GetWindowLong(Application->Handle, GWL_EXSTYLE) & (~WS_EX_APPWINDOW))
      | WS_EX_TOOLWINDOW);

all works fine. The task bar icon disappears.
Later i can use the following code to switch back to the normal mode:

SetWindowLong(Application->Handle, GWL_EXSTYLE,
      (GetWindowLong(Application->Handle, GWL_EXSTYLE) | WS_EX_APPWINDOW) 
      & (~WS_EX_TOOLWINDOW));

It works. The task bar appears again.
And than, if i execute the first code line for a second time, the 
task bar _no more_ disappears.

best regards,
Jan
Technical Details
Message-ID: <3ff1e2bd@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ff17a91@newsgroups.borland.com> <3ff1c0dd$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,3dad11c17b4bae3d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-30 13:02:18 PST
User-Agent: Hamster/1.3.23.4
From: Jan Weingärtner <jweingart@gmx.de>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ff17a91@newsgroups.borland.com> <3ff1c0dd$1@newsgroups.borland.com>
Subject: Re: Move program into the system tray with SetWindowLong
Date: Tue, 30 Dec 2003 21:43:31 +0100
Lines: 35
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 217.1.178.57
Message-ID: <3ff1e2bd@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1072816829 217.1.178.57 (30 Dec 2003 12:40:29 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail