Archive: Remove task bar item


Remove task bar item
If I am unable to create a tray icon, is it possible to hide the programs' task bar item?
Also, once hiding it, I would like to be able to show it again.

Thanks

-Stu


If it cannot be done using the System plugin, can it be done from changing somthing in the UI exe with Resource Hacker?

-Stu


It can be done using the System plug-in. You need to call GetWindowLong and SetWindowLong. Search Google for C code that does this and try to convert it to System.dll calls.


I've looked at those on MSDN to no avail.
All I want to do now is remove the task bar item for my settings exe that is executed from my main installer.
I no-longer want to be able to get it back again.

Help! :(

-Stu


First result on Google for "SetWindowLong taskbar":
http://www.experts-exchange.com/Prog..._10081312.html

Convert that to System.dll and it should work. If you have .NET Framework search for the constants (GWL_EXSTYLE, WE_EX_..., etc.) in the .h files in the Include directory of the framework. If you can't find it, add VB to the search term, they always define the constants there.


This is a small attempt; i'm sure it is extremely incomplete or completely wrong!

System::Call 'Win32::SetWindowLong($HWNDPARENT, GWL_EXSTYLE)'

-Stu


I also found this:
http://upc.pkmn.co.uk/win32/task.shtml

-Stu


I know a plugin is being made to do this, but what would be the System plugin way?
I just want to use the System plugin code for now to see what advantages/disadvantages it will make.

-Stu


You were on the right track, why did you stop? You should define GWL_EXSTYLE as the right value, add another parameter to the function call (SetWindowLong takes 3 not 2) and add 'A' to the function name.


!define GWL_EXSTYLE -20

System::Call 'Win32::SetWindowLongA($HWNDPARENT, ${GWL_EXSTYLE}, )'

I'm not at all sure what GWL_EXSTYLE should be.
I could only find
Const GWL_EXSTYLE = (-20)
on some web hits.

Also, have I added another parameter correctly?

-Stu


Looking on MSDN, is this what I want?

WS_EX_NOACTIVATE

Description:
Windows 2000/XP: A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.
To activate the window, use the SetActiveWindow or SetForegroundWindow function.

The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.

-Stu


You have to call it in .onGUIInit or it won't take affect. The code is:

!define GWL_EXSTYLE -20
!define WS_EX_APPWINDOW 0x040000
!define WS_EX_TOOLWINDOW 0x000080

Function .onGUIInit
System::Call "user32::GetWindowLongA(i $HWNDPARENT, i ${GWL_EXSTYLE}) i .s"
Pop $1
IntOp $2 ${WS_EX_APPWINDOW} ~
IntOp $1 $1 & $2
IntOp $1 $1 | ${WS_EX_TOOLWINDOW}
System::Call "user32::SetWindowLongA(i $HWNDPARENT, i ${GWL_EXSTYLE}, i r1)"
FunctionEnd
There are some problems with this. It won't show on the alt+tab window and the window itself becomes distorted. Try editing the UI and add those styles to it, it should at least help with the the distortion.

Yikes, I knew it wouldn't be that simple :(

Thanks, it works perfect (on WinXP)
I've added the styles to the ui too.

It's good that it doesn't show in Alt+Tab too, because my installer is executing this dialog with ExecWait anyway.

-Stu


I used a different (slightly easier) approach to this same problem.

Basically I moved all of the content from my main install section to the GUIInit function and then changed my main install section to a single line reading: "SetAutoClose true".

I never see the installation window and everything works perfectly :)


Shouldn't you have placed it all in onInit?

-Stu


I don't think $HWNDPARENT works properly in .onInit...althought it might work. Since I'm trying to use a tray icon in my setup I assumed I would have the problem where the tray icon disappears where you mouse over it unless I put all of the stuff in my GUIInit function.


Oh ok, when you said installing files, that's different.
Yes, $HWNDPARENT only exists onGUIInit, and not onInit.

-Stu