WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: Thekub on July 12, 2016, 05:50:07 PM

Title: Refresh the Taskbar
Post by: Thekub on July 12, 2016, 05:50:07 PM
Looking to enforce a particular custom tool bar on Win7 using the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop TaskbarWinXP value.  Importing the configured registry key does appear to work as desired however the tool bar doesn't display until a logoff\logon or taskkill\relaunch of explorer.  Ideally there would be a means to import these settings then "refresh" the taskbar to show the new toolbar but I'm having trouble finding the right means to do so. 

I figured it will likely require using DllCall and executing a particular function.  I was doing some generic internet searches and found a handful of references for people trying to do operations with the SysTray or the Icon Cache to fix various things but these didn't appear to be what I need.  Out of the threads the information seemed to indicate that the taskbar is a window so I tried a few things like attempting to call the UpdateWindow on the handle for Shell_TrayWnd from the User32.dll but this didn't appear to do what I had hoped it would.

Looking to see if there is anyone a bit more experienced with the windows API (or perhaps the control manager extender if that has the secret sauce I need) that might be able to point me in the right direction. 

Thanks
Title: Re: Refresh the Taskbar
Post by: td on July 12, 2016, 06:19:12 PM
Take a look at IntControl 59.   I don't think it will get the Windows shell to redraw the task bar but it easy enough to test.  When time permits tomorrow, will check into it a bit more.
Title: Re: Refresh the Taskbar
Post by: Thekub on July 12, 2016, 07:03:30 PM
Does not appear so.  Tried with the window handle "ControlHandle=cWndByWndSpec("Shell_TrayWnd","explorer",0)" and "-1" as P1 and "" and "Desktop" as P2. 
Title: Re: Refresh the Taskbar
Post by: td on July 13, 2016, 08:22:35 AM
Unfortunately I am not seeing any way to force the Windows shell to reread your registry setting short of stopping and restarting the shell.   The shell API has several notification functions but based on their documentation none of them appear to cause the the shell to read the registry setting of interest.   

If you want to try one of the shell APIs for yourself, here is an example in the Tech Database:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Desktop+Refresh~Desktop.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Desktop+Refresh~Desktop.txt)