by Karim Mohammad (2 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 16th April 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Hides Desktop and shows
Begin VB.Form Form1
BackColor = &H00D8E9EC&
BorderStyle = 4 'Fixed ToolWindow
Caption = "Program by Karim"
ClientHeight = 1560
ClientLeft = 45
ClientTop = 285
ClientWidth = 3540
FillColor = &H00D8E9EC&
ForeColor = &H00D8E9EC&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1560
ScaleWidth = 3540
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton Command2
BackColor = &H00D8E9EC&
Caption = "Hide Desktop"
Height = 495
Left = 240
MaskColor = &H00D8E9EC&
Style = 1 'Graphical
TabIndex = 1
Top = 480
Width = 855
End
Begin VB.CommandButton Command1
BackColor = &H00D8E9EC&
Caption = "Show Desktop"
Height = 495
Left = 2280
MaskColor = &H00D8E9EC&
Style = 1 'Graphical
TabIndex = 0
Top = 480
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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
Option Explicit
Private Sub Command1_Click()
Form1.Caption = "Desktop is Opened"
'To Show Desktop
Dim hWnd As Long
hWnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
ShowWindow hWnd, 1
End Sub
Private Sub Command2_Click()
'To Hide Desktop
Form1.Caption = "Desktop is under HIDDEN"
Dim hWnd As Long
hWnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
ShowWindow hWnd, 0
End Sub
Private Sub Form_Load()
Me.Caption = "Program by Karim"
End Sub