PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Hide/Show DeskTop and TaskBar
The following tip uses the Window API to Hide and Show the Desktop from the user. Some applications need to block out the user interaction and switching off the desktop and task bar are a great way to achieve this.

Declare the following two API calls

Function long FindWindowExA & 
   ( long hWnd, long hWndChild, ref string lpszClassName, &
   ref string lpszWindow) library 'user32'
Function long ShowWindow &
   (long hWnd, long nCmdShow ) library 'user32'

Then add the following Powerscript:

// Constants for ShowWindow()
Constant Long SW_HIDE = 0
Constant Long SW_NORMAL = 1
Constant Long SW_SHOWMINIMIZED = 2
Constant Long SW_SHOWMAXIMIZED = 3
Constant Long SW_SHOWNOACTIVATE = 4
Constant Long SW_SHOW = 5
Constant Long SW_MINIMIZE = 6
Constant Long SW_SHOWMINNOACTIVE = 7
Constant Long SW_SHOWNA = 8
Constant Long SW_RESTORE = 9
Constant Long SW_SHOWDEFAULT = 10

// Names of the shell windows we'll be looking for
String ls_ShellViewWnd = "Progman"
String ls_ShellTaskBarWnd = "Shell_TrayWnd"
String ls_Null

// Locals
Long ll_HTaskBar, ll_HDeskTop

// Hide task bar
ll_HTaskBar = FindWindowExA( 0, 0, ls_ShellTaskBarWnd, ls_Null )
ShowWindow( ll_HTaskBar, SW_HIDE )

// Hide Desktop
ll_HDeskTop = FindWindowExA( 0, 0, ls_ShellViewWnd, ls_Null )
ShowWindow( ll_HDeskTop, SW_HIDE )

// Pause to Restore
MessageBox( 'pbdr.com', 'look no hands!' )

// Show task bar
ll_HTaskBar = FindWindowExA( 0, 0, ls_ShellTaskBarWnd, ls_Null )
ShowWindow( ll_HTaskBar, SW_SHOW )

// Show Desktop
ll_HDeskTop = FindWindowExA( 0, 0, ls_ShellViewWnd, ls_Null )
ShowWindow( ll_HDeskTop, SW_SHOW )
 

Top of Page

Legal Notice

Ken Howe 2011