- Автор темы
- Добавить закладку
- #41
Пожалуйста, обратите внимание, что пользователь заблокирован
Простое решение для обновления проводника windowsРаботает только после обновления explorer или ребута пк. Как сделать обновлние сразу после этого?C#:string subKey = @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; string h = "Hidden"; int r = 0; RegistryKey k = Registry.CurrentUser; k = k.CreateSubKey(subKey); k.SetValue(h, r);
Нашел. (С)https://ipconfig.ws/threads/129/
Создадим класс NativeMethods.cs
C#:
internal static class NativeMethods
{
#region For Refresh WinExplorer
[DllImport("user32")]
public static extern int PostMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(string className, string caption);
[DllImport("user32", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(IntPtr parent, IntPtr startChild, string className, string caption);
#endregion
}
Создадим класс RefreshExp.cs
C#:
public class RefreshExp
{
public static void Inizialize()
{
IntPtr d = NativeMethods.FindWindow("Progman", "Program Manager");
d = NativeMethods.FindWindowEx(d, IntPtr.Zero, "SHELLDLL_DefView", null);
d = NativeMethods.FindWindowEx(d, IntPtr.Zero, "SysListView32", null);
NativeMethods.PostMessage(d, 0x100, new IntPtr(0x74), IntPtr.Zero);
NativeMethods.PostMessage(d, 0x101, new IntPtr(0x74), new IntPtr(1 << 31));
}
}