powershell apply new settings to taskbar

天涯浪子 提交于 2019-12-01 21:40:45

I've used the script above to send message to applications that there are new settings from the registry. Not all application can receive this message but I think explore does.

Give it a try, calling it after registry settings are applied:

$sign = @"
using System;
using System.Runtime.InteropServices;

public static class RegUpdate
{
    private const int HWND_BROADCAST = 0xffff;
    private const int WM_WININICHANGE = 0x001a, WM_SETTINGCHANGE = WM_WININICHANGE, INI_INTL = 1;
      [DllImport("user32.dll")] 
    private static extern int SendMessage(int hWnd, uint wMsg, uint wParam, uint lParam); 

    public static string SendM()
    {
        try
                {                   
                   SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, INI_INTL);
                   return "0";
                }

                catch (Exception ex)
                {
                    return (ex.Message);              
                }
    }
}
"@
$type = Add-Type -TypeDefinition $sign -Language CSharp -PassThru
$type::SendM()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!