Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Taskbar
- {
- [DllImport("user32.dll")]
- public static extern int FindWindow(string className, string windowText);
- [DllImport("user32.dll")]
- public static extern int ShowWindow(int hwnd, int command);
- public const int SW_HIDE = 0;
- public const int SW_SHOW = 1;
- public int _taskbarHandle;
- protected static int Handle
- {
- get
- {
- return FindWindow("Shell_TrayWnd", "");
- }
- }
- public Taskbar()
- {
- _taskbarHandle = FindWindow("Shell_TrayWnd", "");
- }
- public static void Show()
- {
- ShowWindow(Handle, SW_SHOW);
- }
- public static void Hide()
- {
- ShowWindow(Handle, SW_HIDE);
- }
- }
- public class WinApi
- {
- [DllImport(”user32.dll”, EntryPoint = “GetSystemMetrics”)]
- public static extern int GetSystemMetrics(int which);
- [DllImport(”user32.dll”)]
- public static extern void
- SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter,
- int X, int Y, int width, int height, uint flags);
- private const int SM_CXSCREEN = 0;
- private const int SM_CYSCREEN = 1;
- private static IntPtr HWND_TOP = IntPtr.Zero;
- private const int SWP_SHOWWINDOW = 64; // 0×0040
- public static int ScreenX
- {
- get { return GetSystemMetrics(SM_CXSCREEN);}
- }
- public static int ScreenY
- {
- get { return GetSystemMetrics(SM_CYSCREEN);}
- }
- public static void SetWinFullScreen(IntPtr hwnd)
- {
- SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW);
- }
- }
Add Comment
Please, Sign In to add comment