Re:Hiding icon in taskbar. Please help
Hi there,
Here is a trick that will work. :-) Although you can use the
WS_EX_TOOLWINDOW trick, this gives you "proper" looking dialogs and is
suggest by MS ;-)
Just create a "dummy" main form. This form will NEVER be shown so make
it some small, empty box or whatever. Make sure that your Traybar icon
is visible at all times. Do the following:
1) Create your application.
2) Add TWO forms, the first is your DUMMY main window, the second (and
more) will be the dialogs you want.
3) Change your DPR (application source), by adding the following lines
just before the "Application.Run" line:
program Project1;
uses
Forms,
Windows,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
{ add these next two lines}
Application.ShowMainForm:=false;
ShowWindow(Application.Handle,SW_HIDE);
{}
Application.Run;
end.
- this will hide the mainform (actually, it will prevent it from ever
appearing - i.e. no flicker) and hides the app too.
4) Make sure you can exit the program through your TrayIcon.
Also remember to code your dialogs to just Show/Hide as necessary (do
not minimize them ;-)
Thats it!
Cheers,
George.---
_Snappy_ Software
Quote
Phranc wrote:
> Hello,
> I am looking for a way to hide the icon from the tasbar. The reason is
> that i have a program that has to stay in the tray and must not appear
> in the traybar even if i maximize the main form. I want the program
> only to appear in the tray.
> In VB it was easy; only set the "ShowInTaskbar" to false. I tried in
> Delphi ShowWindow (FrmMain.Handle, SW_HIDE) and that works (the main
> form is invisible at startup), but ShowWindow (Applicaion.Handle,
> SW_HIDE) doesn't work. The icon still appears in the taskbar.
> Who has the solution for my problem? If possible, post some code,
> cause i'm new to Delphi (and i definately don't want to go back to
> VB).
> I am using Delphi 3 Standard with Windows 95.
> Many thanks on beforehand for you time.
> Phranc
> PS Could you please CC to my e-mail address; i don't get all messages
> from my ISP.
> =================
> The optimist thinks this is the best of all possible worlds.
> The pessimist fears it is true.
> =================
> http://huizen.dds.nl/~phranc