dcsimg
December 9, 2016
Hot Topics:

Hide the Desktop

  • November 19, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

Add a form (frmMain) To the form add two command buttons, cmdHideDesktop and cmdShowDesktop. Copy the following code into the form's General Declarations procedure:

Option Explicit
DefLng A-Z

Private Function FindShellWindow() As Long
Dim hWnd As Long
On Error Resume Next

hWnd = FindWindowEx(0&, 0&, _
  g_cstrShellViewWnd, vbNullString)

If hWnd <> 0 Then
  FindShellWindow = hWnd
End If

End Function

Private Sub HideShowWindow(ByVal hWnd As Long, _
  Optional ByVal Hide As Boolean = False)

 Dim lngShowCmd As Long
 On Error Resume Next

 If Hide = True Then
   lngShowCmd = SW_HIDE
 Else
   lngShowCmd = SW_SHOW
 End If

 Call ShowWindow(hWnd, lngShowCmd)

End Sub

Private Sub cmdShowDesktop_Click()
 Dim hWnd As Long
 On Error Resume Next

 '-- Find the window we're 
 ' looking for and then hide it
 hWnd = FindShellWindow()

 If hWnd <> 0 Then
   Call HideShowWindow(hWnd)
 End If

End Sub

Private Sub cmdHideDesktop_Click()
 Dim hWnd As Long
 On Error Resume Next

 hWnd = FindShellWindow()

 If hWnd <> 0 Then
   Call HideShowWindow(hWnd, True)
 End If

End Sub




Page 3 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel