Hi.
I don't know what code you're using to retrieve the thread for the window,
but one may use the Windows API's to return the Windows handle for a
particular application that is open, and perhaps that will help you. Please
see the following Web page for the basic code to be modified for Windows
Explorer:
http://www.mvps.org/access/api/api0007.htm
In the Select Case block, add:
Case "explore": strClassName = "ExploreWClass"
The variable lngH contains the Windows Handle to the first instance of
Windows Explorer found. If there are multiple instances of Windows Explorer
open while this code is running, then iterate through the instances and check
the Windows Caption for a match to the window you're looking for. Use the
following function to determine the Window's Caption Property from this
Window Handle:
' (Add this API function to the Declarations section of the standard module
Private Declare Function apiGetWindowText Lib "user32" _
Alias "GetWindowTextA" _
(ByVal hWnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) _
As Long
' (Then paste this function into the standard module
Private Function fGetCaption(hWnd As Long) As String
' Returns the caption of a Window
'
Dim strBuffer As String
Dim lngCount As Long
strBuffer = String$(MAX_LEN + 1, 0)
lngCount = apiGetWindowText(hWnd, strBuffer, MAX_LEN)
If lngCount > 0 Then fGetCaption = Left$(strBuffer, lngCount)
End Function
On the other hand, one may also use AppActivate to return the TaskID for a
particular window. For example:
Dim rtn As Double
rtn = Shell("C:\Program Files\Internet Explorer\iexplore.exe",1) ' Run IE.
AppActivate rtn ' Activate IE.
.. . . where rtn is the TaskID.
Older versions have Windows Explorer as a separate application, but its
integrated into Windows XP, so you may not be able to run it in Shell on your
workstation.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.