Update Explorer configuration without restarting it

走远了吗. 提交于 2019-12-30 10:48:08

问题


I am wondering is there a way to refresh the HKLM registry key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer - without restarting the shell.

I would like to be able to do this without restarting explorer. Is there any known way to do that ?

So far, I found only this thing:

RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

which doesn't work for my case.

It looks insane to me that MS made Explorer so it can't re-read its configuration while running) but you never know.

EDIT: What I try to do is to disable/enable notification area (tray) without restarting. The registry key is

Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\

Variable: NoTrayItemsDisplay

Value: 1/0

EDIT 2 This is the source code that supposed to work, but on Vista it doesn't, not for notification area, not for my testing dummy which was MyMusic in startMenu (variable NoStartMenuMyMusic)

#include <stdio.h>
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
   DWORD dwRetVal;

  int  lResult = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM)0,
                      (LPARAM)"Policy",
                      SMTO_ABORTIFHUNG, 5000, &dwRetVal);

   printf("lResult  = %ld\n", lResult);
   printf("dwRetVal = %ld\n", dwRetVal);

   return 0;
}

I tried all sane wparam and lparam values without success. I took the code from here and dude claims it works...

This article, however, claims that code doesn't work.

Whats even more ridiculous is that gpupdate is suposed to do the job.

Thx.


回答1:


Try sending the WM_SETTINGCHANGE message with wparam=0 and lparam="Policy" to the taskbar, not sure if this can be done with scripting



来源:https://stackoverflow.com/questions/1405269/update-explorer-configuration-without-restarting-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!