|
-
Nov 10th, 2000, 08:22 PM
#1
Thread Starter
New Member
How to retrieve a path of opened Windows Explorer window?
-
Nov 11th, 2000, 12:12 AM
#2
Is this what you want?
Code:
Private Declare Function GetWindowsDirectory _
Lib "kernel32" Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Command1_Click()
Dim strFindWinDir$, WinDir$
WinDir$ = Space(144)
strFindWinDir$ = GetWindowsDirectory(WinDir$, 144)
WinDir$ = Trim(WinDir$)
MsgBox WinDir$
End Sub
-
Nov 11th, 2000, 04:22 PM
#3
Thread Starter
New Member
Hmmm... this code is not actually what am I looking for, but I found it useful, thanx. The thing that I am asking about is how to get the directory that is being viewed in Windows Explorer window; for example, by using window handle I want to be able to see which directory is shown in that particular window.
-
Nov 11th, 2000, 04:43 PM
#4
Sorry for the misunderstanding.
Code:
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Private Declare Function GetWindowTextLength Lib "user32" _
Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString _
As String, ByVal cch As Long) As Long
Public Function GetWindowTitle(ByVal hwnd As Long) As String
Dim l As Long
Dim s As String
l = GetWindowTextLength(hwnd)
s = Space(l + 1)
GetWindowText hwnd, s, l + 1
GetWindowTitle = Left$(s, l)
End Function
Private Sub Command1_Click()
Dim cabinetwclass As Long
cabinetwclass = FindWindow("cabinetwclass", vbNullString)
MsgBox GetWindowTitle(cabinetwclass)
End Sub
-
Nov 11th, 2000, 06:54 PM
#5
Thread Starter
New Member
Gr8 code, thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|