Results 1 to 2 of 2

Thread: dir

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 1999
    Posts
    204
    how do you see if a dir is open or not
    WHat would we do with out Microsoft.
    A lot more.

  2. #2
    Guest
    Use the FindWindow and FindWindowEx api functions.

    Code:
    Private Declare Function FindWindow Lib "user32.dll" _
    Alias "FindWindowA" (ByVal lpClassName As Any, ByVal _
    lpWindowName As Any) As Long
    
    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 Sub Command1_Click()
    
    Dim cabinetwclass As Long, shelldlldefview As Long, internetexplorerserver As Long
    Dim atlshellembedding As Long, syslistview As Long
    cabinetwclass = FindWindow("cabinetwclass", vbNullString)
    shelldlldefview = FindWindowEx(cabinetwclass, 0&, "shelldll_defview", vbNullString)
    internetexplorerserver = FindWindowEx(shelldlldefview, 0&, "internet explorer_server", vbNullString)
    atlshellembedding = FindWindowEx(internetexplorerserver, 0&, "atl shell embedding", vbNullString)
    syslistview = FindWindowEx(atlshellembedding, 0&, "syslistview32", vbNullString)
    If cabinetwclass <> 0 Then
    MsgBox "Folder open"
    Else
    MsgBox "Folder closed"
    End If
    
    End Sub
    That's to see if A folder is open. If you want to find out if a specific folder is open or not:

    Code:
    Private Sub Command1_Click()
    
        hWin = FindWindow(vbNullString, "Folder caption")
        If hWin <> 0 Then
            MsgBox "Folder open"
        Else
            MsgBox "Folder closed"
        End If
        
    End Sub

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