Bonjour,
Je suis entrain de développer une application en Csharp (console application), elle permet de détecter les fenetres ouvertes (celles de la barre de taches) et de donner leurs noms. Enfaite ce que je veux faire, c'est de détecter les chemins de ces fenetres, par exemple pour les fichiers word ouverts.
Autrement dit, si j'ai un fichier word sur mon bureau, je veux que le chemin soit: "C:\Documents and Settings\Administrator\Desktop\MonfichierWord.doc".
mais en utilisant:

GetWindowThreadProcessId(hwnd, out pid);
Process p = Process.GetProcessById(pid);
Console.WriteLine(p.MainModule.FileName);

elle me renvoit: "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"

Je sait pas comment faire, alors SVP, qq1 a une idée ??
Merci

Recommended Answers

All 2 Replies

Hello,

I am currently developping an application in c# (console app). It is detecting the open windows (the ones population the taskbar) and it gives their name. Well, what I want to do is detect the path of these windows a good example would be word documents opened.

i.e.:
If i have a file on my desktop ( that is currently opened in word? ) I wan the path to be "C:\Documents and Settings\Administrator\Desktop\MonfichierWord.doc"
using:

GetWindowThreadProcessId(hwnd, out pid);
 Process p = Process.GetProcessById(pid);                            
 Console.WriteLine(p.MainModule.FileName);

it returns me "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"

I have no clue on how to do this, so please, anyone has an idea?

Thank you!:)

I translated :)

oh and by the way, the title of the thread would be:

"path of an opened word document"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.