المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to get the File Path using WMI



C# Programming
08-12-2009, 03:37 PM
Hi all !

When the file is closed, i just want to know the file path.

I am using as bellow :

ManagementEventWatcher mngWatch;
WqlEventQuery wqlEQ;
wqlEQ = new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace");
wqlEQ.EventClassName = "Win32_ProcessStartTrace";
mngWatch = new ManagementEventWatcher(wqlEQ);
mngWatch.EventArrived += new EventArrivedEventHandler(mngWatch_EventArrived);
mngWatch.Start();

from this event creator i can get an Exe path not a File path :

1) in the Process.MainModule name contains the Exe path of the notepad
rather i want the real path from where the file is opened
2) For more clarity if i open a file form D:\\test.txt then i when the file is closed, i want to get that FILE PATH


can some one help me how to do that.


thanks a lot

Regards
.....Jack