Jump to content

Looking for best method of No Taskbar Icon


qwert
 Share

Recommended Posts

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.

 

Link to comment
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

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

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

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

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
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.

 

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...