Jump to content

Resizing the Tray after hiding Icons


Recommended Posts

I'm trying to hide icons and using the SysTray UDF. Problem is that after hiding icons, the tray is full of empty space and won't resize itself. I've checked all the posts I can find related to this but none address this particular problem.

So I've tried using SENDMESSAGE to tell the tray to update/resize as suggested in one post but I don't really know what to do with the LPARAM. Here's my code: (any help would be very much appreciated including another method if something else would work better)

#include "SysTray_UDF.au3"
#NoTrayIcon

Local Const $WM_SIZE       = 5
Local Const $SIZE_RESTORED = 0

;get the number of icons in the tray
$n = _SystrayIconCount() + 1
MsgBox(0,"Debug Info","Icon count = " & $n)

;get pids of all processes that have an icon in the tray
$iPids = _SysTrayIconPids()

;make each hidden
For $i = 0 To UBound($iPids)-1
   _SysTrayIconHide(_SysTrayIconIndex($iPids[$i],2),1)
Next

Local $trayHwnd = _FindTrayToolbarWindow(1)
If $trayHwnd = -1 Then Exit
DllCall("user32.dll", "int", "SendMessageW", "hwnd", $trayHwnd, "uint", $WM_SIZE, "wparam", $SIZE_RESTORED, "lparam", 0)

Sleep(10000)

;make each visible
For $i = 0 To UBound($iPids)-1
   _SysTrayIconHide(_SysTrayIconIndex($iPids[$i],2),0)
Next
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...