本帖最后由 jyswjjgdwtdtj 于 2024-8-26 15:09 编辑
- #powershell
- add-type -typedefinition 'using System.Runtime.InteropServices;
- using System.Timers;
- using System;
-
- public class csclass
- {
- [DllImport("user32.dll")]
- public static extern int ShowWindow(int hwnd, int nCmdShow);
- [DllImport("user32.dll", EntryPoint = "FindWindowExA")]
- private static extern IntPtr FindWindowExA(IntPtr hWndParent, IntPtr hWndChildAfter, string lpszClass, string lpszWindow);
- [DllImport("user32.dll", EntryPoint = "EnumWindows")]
- private static extern int EnumWindows(EnumWindowsProc ewp, IntPtr lParam);
- private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
- public static Timer timer = new Timer();
- public static void Main()
- {
- timer.Interval = 10;
- timer.Enabled = false;
- timer.AutoReset = true;
- IntPtr Fv = IntPtr.Zero;
- EnumWindows((hwnd, lParam) =>
- {
- IntPtr fv = FindWindowExA(hwnd, IntPtr.Zero, "SHELLDLL_DefView", null);
- if (fv != IntPtr.Zero)
- {
- Fv = fv;
- }
- return true;
- }, IntPtr.Zero);
- ShowWindow((int)Fv, 0);
- timer.Elapsed += (s, e) => {
- };
- }
- }'
- [csclass]:Main()
复制代码 若要解除 则将ShowWindow((int)Fv, 0);处0改为1 |