Get a list of Applications from Task Manager not process

There are lots of variations of this code on EE to retrieve the process that are running

Dim strWinMgt As String
Dim process As Object
Dim objProc As Object
Dim ComName As String
ComName = "YourComputername"

strWinMgt = "winmgmts://" & ComName & ""
Set objProc = GetObject(strWinMgt).ExecQuery("Select * from Win32_Process")
For Each process In objProc
   List1.additem process.Name      

What I need is something that give me a specific file name as listed in the Task Manager application tab.  So instead of finding  Microsoft Word or winword.exe, I need to see if the file Test.doc  is open on this computer.  I can't use word automation because I may be looking for a tif file or a pdf file. I know in advance the full path name of the file, I just need to test to see if it is currently open.
Who is Participating?
fullcontactConnect With a Mentor Commented:
Sorry, looks like that link is dead,

Try this one
As far as I know this can't be done and especially won't happen using vbscript. I have never seen any API that gets this deep into pulling out the actual filename of the document. I know that you can count how many handles are open from another process but this doesn't help much in determining what you need to do. The applications tab just shows the captions of the windows that are currently open not the actuall filename on your computer but the associated applications caption of the process that is handling the file.
You could look through the open windows captions and see the the file name is showing, ie from the applications list in task manager.

You can find some source code for this here :-
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.