Discussion:
Problem of hiding taskbar button under Vista
(too old to reply)
SubZero
2007-11-01 19:29:22 UTC
Permalink
Hello,

The below code does not work, any ideas:

void __fastcall TLoginForm::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params);

Params.ExStyle |= WS_EX_APPWINDOW;
Params.WndParent = GetDesktopWindow();

hideApplicationFromTaskbarManager();
}

void __fastcall hideApplicationFromTaskbarManager(void) // hide the
Application window totally
{
Forms::Application->Title = ""; // to remove from task manager!

ShowWindow(Forms::Application->Handle, SW_HIDE);

SetWindowLong(Forms::Application->Handle,
GWL_EXSTYLE,
WS_EX_TOOLWINDOW);

ShowWindow(Forms::Application->Handle, SW_SHOW);
}
//---------------------------------------------------------------------------

Best Regards,

SZ
Remy Lebeau (TeamB)
2007-11-01 20:16:22 UTC
Permalink
Just saying that it does not work says nothing about the actual problem you
are actually having with it. You need to be more specific.

Which version of BCB are you using?
Post by SubZero
ShowWindow(Forms::Application->Handle, SW_HIDE);
<snip>

I suggest you move that code into the project's WinMain() function directly
instead:

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{

LONG lExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);
SetWindowLong(Application->Handle, GWL_EXSTYLE, lExStyle |
WS_EX_TOOLWINDOW);

Application->Initialize();
Application->Title = "";
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}

void __fastcall TLoginForm::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params);
Params.ExStyle |= WS_EX_APPWINDOW;
Params.WndParent = GetDesktopWindow();
}



Gambit
SubZero
2007-11-02 07:19:10 UTC
Permalink
Hi,

The problem is even with doing what you said, the application taskbar button
does not disappear. I use CodeGear RAD Studio 2007/C++, Vista Biz 64-bits.
Is there a known-to-be-working code somewhere?

Regards,

SZ
Post by Remy Lebeau (TeamB)
Just saying that it does not work says nothing about the actual problem
you are actually having with it. You need to be more specific.
Which version of BCB are you using?
Post by SubZero
ShowWindow(Forms::Application->Handle, SW_HIDE);
<snip>
I suggest you move that code into the project's WinMain() function
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
LONG lExStyle = GetWindowLong(Application->Handle,
GWL_EXSTYLE);
SetWindowLong(Application->Handle, GWL_EXSTYLE, lExStyle |
WS_EX_TOOLWINDOW);
Application->Initialize();
Application->Title = "";
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
void __fastcall TLoginForm::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params);
Params.ExStyle |= WS_EX_APPWINDOW;
Params.WndParent = GetDesktopWindow();
}
Gambit
Remy Lebeau (TeamB)
2007-11-02 17:07:14 UTC
Permalink
Post by SubZero
I use CodeGear RAD Studio 2007/C++
The VCL in RAD2007 has huge changes in regards to how the TForm and
TApplication windows relate to each other. TApplication is no longer the
primary owner of the Taskbar button like it was in earlier versions. There
is a new TApplication::MainFormOnTaskBar property that allows TForm, not
TApplication, to control the Taskbar button. MainFormOnTaskBar is set to
True by default for new projects, and False for earlier projects.

Unfortunately, the introduction of the MainFormOnTaskBar property causes a
lot of runtime bugs. There have many bug reports about incorrect behavior
because of its use. I don't think Borland/CodeGear thought it through deep
enough when they designed it.


Gambit
SubZero
2007-11-02 17:36:52 UTC
Permalink
Good to know these But what do you suggest? Should I feel desperate?? This
is such a common problem, if there is no good solution, shame on CG/Borland.

Regards,

SZ
Post by Remy Lebeau (TeamB)
Post by SubZero
I use CodeGear RAD Studio 2007/C++
The VCL in RAD2007 has huge changes in regards to how the TForm and
TApplication windows relate to each other. TApplication is no longer the
primary owner of the Taskbar button like it was in earlier versions.
There is a new TApplication::MainFormOnTaskBar property that allows TForm,
not TApplication, to control the Taskbar button. MainFormOnTaskBar is set
to True by default for new projects, and False for earlier projects.
Unfortunately, the introduction of the MainFormOnTaskBar property causes a
lot of runtime bugs. There have many bug reports about incorrect behavior
because of its use. I don't think Borland/CodeGear thought it through
deep enough when they designed it.
Gambit
Remy Lebeau (TeamB)
2007-11-02 17:53:29 UTC
Permalink
Post by SubZero
Good to know these But what do you suggest?
I don't have a clue right now. I don't have Vista to play with, and my
RAD2007 is not onhand at the moment to look at.


Gambit
SubZero
2007-11-02 18:07:03 UTC
Permalink
AFAIK, this is the first time you wrote "no clue" here! ;-) :[ Who should we
ask now?
Post by Remy Lebeau (TeamB)
Post by SubZero
Good to know these But what do you suggest?
I don't have a clue right now. I don't have Vista to play with, and my
RAD2007 is not onhand at the moment to look at.
Gambit
Remy Lebeau (TeamB)
2007-11-02 19:04:19 UTC
Permalink
Post by SubZero
AFAIK, this is the first time you wrote "no clue" here! ;-)
My job position recently changed so I no longer have access to my copy of
BDS2006 or RAD2007 during the daytime :-( I have to wait until nighttime
now for any questions involving those versions.


Gambit
SubZero
2007-11-03 07:36:31 UTC
Permalink
Post by Remy Lebeau (TeamB)
MainFormOnTaskBar
this solved my problem. I have not seen any side effects till now but will
be watching...
Post by Remy Lebeau (TeamB)
Post by SubZero
I use CodeGear RAD Studio 2007/C++
The VCL in RAD2007 has huge changes in regards to how the TForm and
TApplication windows relate to each other. TApplication is no longer the
primary owner of the Taskbar button like it was in earlier versions.
There is a new TApplication::MainFormOnTaskBar property that allows TForm,
not TApplication, to control the Taskbar button. MainFormOnTaskBar is set
to True by default for new projects, and False for earlier projects.
Unfortunately, the introduction of the MainFormOnTaskBar property causes a
lot of runtime bugs. There have many bug reports about incorrect behavior
because of its use. I don't think Borland/CodeGear thought it through
deep enough when they designed it.
Gambit
Loading...