0

For example, if the currently focused process is Microsoft Word, and I have opened in it a document called myFile.doc, I know how to get the window text (in this case could be "myFile.doc - Word") and I know how to get the process name ("winword") or the process description ("Microsoft Word").

Is there any way to get only the name of the file opened in the currently focused process? It can be any process.

I know that I can parse the window text and get the opened file, but for example, in spanish version of Notepad the window text format is different ("myFile.txt: Bloc de notas").

I think that maybe there is a way to get aditional details about the currently focused process.

Thanks in advance!

tifa
  • 216
  • 2
  • 6
  • 3
    There is no simple answer if you want this to work with _any_ process. You could get the list of file handles that are opened by a given process, but there will be multiple file opened in the result: the file you're looking for, plus all loaded modules, config files, or whatever file the process needs. – ken2k Feb 04 '15 at 15:38
  • 2
    Check out this previous stackoverflow question for determining open file handles for a particular process: http://stackoverflow.com/questions/177146/how-do-i-get-the-list-of-open-file-handles-by-process-in-c – Michael Di Felice Feb 04 '15 at 15:38

0 Answers0