For the taskbar, this is the Shell_TrayWnd class.
for the Start Button - Button
for notification area - TrayNotifyWnd
for the system clock area - TrayClockWClass
[DllImport("user32.dll")] private static extern IntPtr FindWindow(string ClassName, string WindowName); [DllImport("user32.dll")] private static extern IntPtr FindWindowEx( IntPtr hwndParent, IntPtr hwndChildAfter, string className, string windowName); [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
private IntPtr TaskbarHWnd; // private IntPtr StartButtonHWnd; // private IntPtr TrayNotifyHWnd; // private IntPtr ClockHwnd; //
// . // TaskbarHWnd = FindWindow("Shell_TrayWnd", null); // / if (TaskbarHWnd != IntPtr.Zero) { ShowWindow(TaskbarHWnd, show ? SW_SHOW : SW_HIDE); } show = !show;
StartButtonHWnd = FindWindow("Button", null); if (StartButtonHWnd != IntPtr.Zero) { //ShowWindow(StartButtonHWnd, show ? SW_SHOW : SW_HIDE); // Windows XP SetWindowPos(StartButtonHWnd, IntPtr.Zero, 0, 0, 0, 0, show ? SetWindowPosFlags.SWP_SHOWWINDOW : SetWindowPosFlags.SWP_HIDEWINDOW); }
TaskbarHWnd = FindWindow("Shell_TrayWnd", null); TrayNotifyHWnd = FindWindowEx(TaskbarHWnd, IntPtr.Zero, "TrayNotifyWnd", null); // ShowWindow(TrayNotifyHWnd, show ? SW_HIDE : SW_SHOW); show = !show;
TaskbarHWnd = FindWindow("Shell_TrayWnd", null); TrayNotifyHWnd = FindWindowEx(TaskbarHWnd, IntPtr.Zero, "TrayNotifyWnd", null); // ClockHwnd = FindWindowEx(TrayNotifyHWnd, IntPtr.Zero, "TrayClockWClass", null); // ShowWindow(ClockHwnd, show ? SW_HIDE : SW_SHOW); show = !show;
Source: https://habr.com/ru/post/181049/
All Articles