Jump to content
Sign in to follow this  

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"

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

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


;make each visible
For $i = 0 To UBound($iPids)-1

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.