Sign in to follow this  
Followers 0
qwert

Looking for best method of No Taskbar Icon

7 posts in this topic

Three days of exploring possibilities have left me in a bit of a quandary:

What method is best to use for running a compiled script without a taskbar icon?

 

The first thing I’ll mention is that I can’t use $WS_EX_TOOLWINDOW because my GUI has to minimize sometimes and tool windows put a small placeholder window on the desktop (unless, of course, someone knows how to prevent that).

 

So I’m left with these alternatives:

 

1) Run the script as a child of the desktop ... using the handle from WinGetHandle("Program Manager")

It’s simple and it works ... but is that a good way? Is there a downside?

 

2) As an variation of the above, create my own parent window using $hParent = GUICreate("", 0, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)

It’s simple and works ... but is there a downside to having another gui around?

 

3) ObjCreateInterface ... and then use the info to delete my script’s entry from the taskbar using $oTaskbarList.DeleteTab

It works ... but is the added complexity justified?

 

I also thought I saw a way to just delete the taskbar’s link to my script’s icon as a global operation, but I couldn’t locate the code.

 

So, before I commit to one of these methods, I thought I'd ask if anyone might weigh in with an opinion. And is there even another method?

 

Thanks in advance for any help.

 

Share this post


Link to post
Share on other sites



Just put this at the top of your script:

#NoTrayIcon

Let me know how it go's.

Share this post


Link to post
Share on other sites

Just put this at the top of your script:

#NoTrayIcon

Let me know how it go's.

 

im pretty sure the OP is asking about the Taskbar icon, not the tray icon.


if @error Then
	MsgBox(262192,"",@ComputerName&" slaps "&@UserName&" around a bit with a large trout!")
	EndIf

>Exit code: 0

REAL search results

"Yeah yeah yeah, patience. How long will that take?"  -Ed Gruberman

Share this post


Link to post
Share on other sites

This has already been discussed on the forum. Please check >this thread.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

 

Three days of exploring possibilities have left me in a bit of a quandary:

What method is best to use for running a compiled script without a taskbar icon?

 

The first thing I’ll mention is that I can’t use $WS_EX_TOOLWINDOW because my GUI has to minimize sometimes and tool windows put a small placeholder window on the desktop (unless, of course, someone knows how to prevent that).

 

i use $WS_EX_TOOLWINDOW with a combination of this min to tray code...

'?do=embed' frameborder='0' data-embedContent>>

to get around the placeholder on the desktop.

:alien:


if @error Then
	MsgBox(262192,"",@ComputerName&" slaps "&@UserName&" around a bit with a large trout!")
	EndIf

>Exit code: 0

REAL search results

"Yeah yeah yeah, patience. How long will that take?"  -Ed Gruberman

Share this post


Link to post
Share on other sites

Thanks for the responses and suggestions.

I knew it would be tricky to ask the questions I did. But I had a vision of a masterminded solution that everyone could follow.  Before I posted, I read all posts with taskbar+icon in the titles ... and I tried the methods I described above ... and then tried to properly frame the issues.

 

But I now realize I failed to include a couple of key considerations:

my GUI is a $WS_POPUP style, with no frame, and that also uses $WS_EX_TOPMOST style.

 

To compound matters, I’ve now observed a case where, if the GUI is a child of “program manager”, the child GUI doesn’t stay on top when other windows are activated. Apparently, the parent’s style takes precedence ... or there’s some other subtlety of the Z-order processing.

 

alienclone did point out the Delete Icon method (thanks for that!) that’s partially listed in the help file for _WinAPI_SetClassLongEx. But I now remember the reason I didn’t try _WinAPI_DestroyIcon($hIcon):

"$hIcon = Handle to the icon to be destroyed. The icon must not be in use."

 

Aside from my script being active at the moment, the script uses the icon for the tray. (For the record, my script already uses TrayOnEventMode ... and all processing related to the tray icon, menu and tooltip works with no problems at all.)

 

At the moment, I’m still testing and I’m certainly open to further suggestions.

 

 

Share this post


Link to post
Share on other sites

For anyone who has followed or found this thread, I'll summarize what I ended up using:

I decided on the parent window approach and create my own parent window using:

Global $hP = GUICreate("", 0, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)

That means that the GUICreate for my actual application window ends with $WS_POPUP, $WS_EX_TOPMOST, $hP)

In order to avoid the popup placeholders I mentioned, I then use @SW_HIDE instead of @SW_MINIMIZE whenever I need to "minimize".   I use an icon in the system tray to represent the minimized application.

So far, I haven't found a downside to this method.  The hidden window is immediately visible upon a @SW_SHOW ... and there's never a taskbar icon, not even a flash of one at startup.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0