by Shareef Dana (2 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 14th July 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
hide/show desktop
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Const SPI_SETDESKWALLPAPER = 20
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40
'change this value to the value of pictures u have
Const NumberofPictures = 4
Private Sub cmdChangePicture_Click()
' You can place all this code in a timer
'it will work like webshot
Dim lngSuccess As Long
Dim strBitmapImage As String
Static i As Integer
i = i + 1
strBitmapImage = App.Path & "\" & i & ".bmp"
lngSuccess = SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, strBitmapImage, 1)
If i = NumberofPictures Then
i = 0
End If
End Sub
Private Sub cmdHideShow_Click()
'To Hide Desktop
Dim hWnd As Long
hWnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
ShowWindow hWnd, 0
'Hide Taskbar
Dim rtn As Long
rtn = FindWindow("Shell_traywnd", "")
Call SetWindowPos(rtn, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
Dim fHideStart
fHideStart = hideStartButton
End Sub
Private Sub cmdShowDesktop_Click()
'To Show Desktop
Dim hWnd As Long
hWnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
ShowWindow hWnd, 1
'Show Taskbar
Dim rtn As Long
rtn = FindWindow("Shell_traywnd", "")
Call SetWindowPos(rtn, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
'show Start Button
Dim fShowStart
fHideStart = showStartButton
End Sub
Function hideStartButton()
'This Function Hides the Start Button'
OurParent& = FindWindow("Shell_TrayWnd", "")
OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
ShowWindow OurHandle&, 0
End Function
Function showStartButton()
'This Function Shows the Start Button'
OurParent& = FindWindow("Shell_TrayWnd", "")
OurHandle& = FindWindowEx(OurParent&, 0, "Button", vbNullString)
ShowWindow OurHandle&, 5
End Function
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
cmdHideShow_Click
End Sub
Private Sub Image1_Click()
cmdShowDesktop_Click
End
End Sub