Old 4th August 2003, 21:46   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 5th August 2003, 11:09   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
If it cannot be done using the System plugin, can it be done from changing somthing in the UI exe with Resource Hacker?

-Stu
Afrow UK is offline   Reply With Quote
Old 5th August 2003, 11:44   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 5th August 2003, 11:51   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 5th August 2003, 12:05   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 5th August 2003, 13:43   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
This is a small attempt; i'm sure it is extremely incomplete or completely wrong!

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

-Stu
Afrow UK is offline   Reply With Quote
Old 5th August 2003, 13:49   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I also found this:
http://upc.pkmn.co.uk/win32/task.shtml

-Stu
Afrow UK is offline   Reply With Quote
Old 9th August 2003, 13:11   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 9th August 2003, 13:15   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 9th August 2003, 13:30   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
!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
Afrow UK is offline   Reply With Quote
Old 9th August 2003, 13:35   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 9th August 2003, 14:49   #12
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You have to call it in .onGUIInit or it won't take affect. The code is:

Quote:
!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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 9th August 2003, 16:18   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 19th August 2003, 20:28   #14
tarwal2
Junior Member
 
Join Date: Aug 2003
Posts: 3
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
tarwal2 is offline   Reply With Quote
Old 20th August 2003, 13:26   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Shouldn't you have placed it all in onInit?

-Stu
Afrow UK is offline   Reply With Quote
Old 20th August 2003, 15:11   #16
tarwal2
Junior Member
 
Join Date: Aug 2003
Posts: 3
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.
tarwal2 is offline   Reply With Quote
Old 20th August 2003, 15:24   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Oh ok, when you said installing files, that's different.
Yes, $HWNDPARENT only exists onGUIInit, and not onInit.

-Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump