Window API for know what file is opened through a Window?


I've a windows xp and sp3.

I know a complete path of a file. How can I check if the file is opened?

The applications that could open this file is either Notepad, Wordpad or textpad.

It could be so that there would be multiple instances of that application opening the same file at some time.

In any case, I would like to close this file and close the associated application.

I have the following strategies in my mind for checking if the file is open and is opened by some application:

1. Know what all windows are currently opened. Iterate on each of these window to know which are the ones that have opened that file.

Unfortuately, I do not know any Window API for finding which file is opened in that window?

2. The other approach would be get all the running processes in the system. Iterate on all of them to find what there command line parameters are.

Please help.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion