Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. public class Taskbar
  2. {
  3. [DllImport("user32.dll")]
  4. public static extern int FindWindow(string className, string windowText);
  5. [DllImport("user32.dll")]
  6. public static extern int ShowWindow(int hwnd, int command);
  7.  
  8. public const int SW_HIDE = 0;
  9. public const int SW_SHOW = 1;
  10.  
  11. public int _taskbarHandle;
  12. protected static int Handle
  13. {
  14. get
  15. {
  16. return FindWindow("Shell_TrayWnd", "");
  17. }
  18. }
  19.  
  20. public Taskbar()
  21. {
  22. _taskbarHandle = FindWindow("Shell_TrayWnd", "");
  23. }
  24.  
  25. public static void Show()
  26. {
  27. ShowWindow(Handle, SW_SHOW);
  28. }
  29.  
  30. public static void Hide()
  31. {
  32. ShowWindow(Handle, SW_HIDE);
  33. }
  34. }
  35.  
  36. public class WinApi
  37. {
  38. [DllImport(”user32.dll”, EntryPoint = “GetSystemMetrics”)]
  39. public static extern int GetSystemMetrics(int which);
  40.  
  41. [DllImport(”user32.dll”)]
  42. public static extern void
  43. SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter,
  44. int X, int Y, int width, int height, uint flags);
  45.  
  46. private const int SM_CXSCREEN = 0;
  47. private const int SM_CYSCREEN = 1;
  48. private static IntPtr HWND_TOP = IntPtr.Zero;
  49. private const int SWP_SHOWWINDOW = 64; // 0×0040
  50.  
  51. public static int ScreenX
  52. {
  53. get { return GetSystemMetrics(SM_CXSCREEN);}
  54. }
  55.  
  56. public static int ScreenY
  57. {
  58. get { return GetSystemMetrics(SM_CYSCREEN);}
  59. }
  60.  
  61. public static void SetWinFullScreen(IntPtr hwnd)
  62. {
  63. SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW);
  64. }
  65. }
Add Comment
Please, Sign In to add comment