-
If I remember correctly, this should do it:
Code:
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 Const SW_SHOW = 5
Private Const SW_HIDE = 0
Private Sub Command1_Click()
Dim Hwnd As Long
On Error Resume Next
Hwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
If Hwnd = 0 Then
Exit Sub
End If
ShowWindow Hwnd, SW_HIDE
End Sub
Private Sub Command2_Click()
Dim Hwnd As Long
On Error Resume Next
Hwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
If Hwnd = 0 Then
Exit Sub
End If
ShowWindow Hwnd, SW_SHOW
End Sub
Hope this helps.
-
-
That's odd, because I went ahead and placed this code into a simple project and tried it, and it worked just like it was suppost to. (Worked on a Win98 and Win2000 Machine.) Command1 will hide the icons, and Command2 will shows the icons. I don't have the foggest why it wouldn't work for you.
-
Try this:
Code:
Public Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Public 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
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd _
As Long, ByVal nCmdShow As Long) As Long
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Private Sub Command1_Click()
'Hide
Dim progman As Long, shelldlldefview As Long, syslistview As Long
progman = FindWindow("progman", vbNullString)
shelldlldefview = FindWindowEx(progman, 0&, "shelldll_defview", vbNullString)
syslistview = FindWindowEx(shelldlldefview, 0&, "syslistview32", vbNullString)
Call ShowWindow(syslistview, SW_HIDE)
End Sub
Private Sub Command2_Click()
'Show
Dim progman As Long, shelldlldefview As Long, syslistview As Long
progman = FindWindow("progman", vbNullString)
shelldlldefview = FindWindowEx(progman, 0&, "shelldll_defview", vbNullString)
syslistview = FindWindowEx(shelldlldefview, 0&, "syslistview32", vbNullString)
Call ShowWindow(syslistview, SW_SHOW)
End Sub
-
hrmmm
i went and tried it again. it did work, but if the user already has the icons hidden, you cant show the icons. thanks much
-
ack
when i use the code posted, the window is actually
hidden, and you cant right click on the desktop, say, to
change display properties. any code that could pop that
menu up as well?
thankees