Results 1 to 6 of 6

Thread: Active Desktop

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    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.

  2. #2
    Guest

    Unhappy

    Didn't work...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    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.

  4. #4
    Guest
    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

  5. #5
    Guest

    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

  6. #6
    Guest

    Unhappy 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width