Advertisement
1400_SpaceCat

wpktb.py

Oct 6th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. import ctypes
  2. from ctypes import wintypes
  3.  
  4. user32 = ctypes.WinDLL("user32")
  5.  
  6. TOGGLE_UNHIDEWINDOW = 0x40
  7. TOGGLE_HIDEWINDOW   = 0x80
  8.  
  9. user32.FindWindowW.restype = wintypes.HWND
  10. user32.FindWindowW.argtypes = (
  11.     wintypes.LPCWSTR, # lpClassName
  12.     wintypes.LPCWSTR) # lpWindowName
  13.  
  14. user32.SetWindowPos.restype = wintypes.BOOL
  15. user32.SetWindowPos.argtypes = (
  16.     wintypes.HWND, # hWnd
  17.     wintypes.HWND, # hWndInsertAfter
  18.     ctypes.c_int,  # X
  19.     ctypes.c_int,  # Y
  20.     ctypes.c_int,  # cx
  21.     ctypes.c_int,  # cy
  22.     ctypes.c_uint) # uFlags
  23.  
  24. def hide_taskbar():
  25.     handleW1 = user32.FindWindowW(u"Shell_traywnd", u"")
  26.     user32.SetWindowPos(handleW1, 0, 0, 0, 0, 0, TOGGLE_HIDEWINDOW)
  27.  
  28. def unhide_taskbar():
  29.     handleW1 = user32.FindWindowW(u"Shell_traywnd", u"")
  30.     user32.SetWindowPos(handleW1, 0, 0, 0, 0, 0, TOGGLE_UNHIDEWINDOW)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement