private void ToggleWindowSticky(IntPtr hwnd) { try { if (WindowsDesktop.Interop.ComObjects.GetVirtualDesktopPinnedApps() == null) { WinAPI.SetWindowLongPtr(hwnd, WinAPI.GWL_EXSTYLE, WinAPI.GetWindowLongPtr(hwnd, WinAPI.GWL_EXSTYLE).XOR(WinAPI.WS_EX_TOOLWINDOW)); } else { VirtualDesktopHelper.TogglePinWindow(hwnd); } } catch { } }
public static void TogglePin(this IntPtr hWnd) { VirtualDesktopHelper.TogglePinWindow(hWnd); }