日期:2014-05-17 浏览次数:21184 次
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd,int Msg,int wParam,int lParam);
public const int WM_SETTINGCHANGE = 26;
public const int HWND_BROADCAST = 65535;
static void Main(string[] args)
{
int value = Convert.ToInt32(Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "Shell Icon Size", -1).ToString());
Registry.SetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "Shell Icon Size", value - 1, RegistryValueKind.String);
SendMessage(new IntPtr(HWND_BROADCAST), WM_SETTINGCHANGE, 0, 0);
Registry.SetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "Shell Icon Size", value, RegistryValueKind.String);
SendMessage(new IntPtr(HWND_BROADCAST), WM_SETTINGCHANGE, 0, 0);
}