|
-
Dec 19th, 2005, 12:29 PM
#1
Thread Starter
Member
Retrieve File Path ?
How do retrieve the path of a File open in a foreign process ?
Thank you.
-
Dec 19th, 2005, 12:34 PM
#2
Re: Retrieve File Path ?
Welcome to the forums. 
What do you mean by "foreign process"?
-
Dec 19th, 2005, 12:59 PM
#3
Thread Starter
Member
Re: Retrieve File Path ?
 Originally Posted by Hack
Welcome to the forums.
 What do you mean by "foreign process"?
I mean a running application . It could be Word, Excel, NotePad ...
However, I do not want to use Automation for this as not every application supports it.
Thanks.
-
Dec 19th, 2005, 11:03 PM
#4
Re: Retrieve File Path ?
To get the file path you can use the mainmodule property of the process class. I used winamp in the example. Note that GetProcessesByName creates an array and populates it. An array, because there can be more than one processes with the same name - like 3 notepad windows.
VB Code:
Dim Proc As Process() = Process.GetProcessesByName("winamp")
lbl1.Text = Proc(0).MainModule.FileName
EDIT: Upsss, I noticed too late it is the API section. Still, you can do it this way without API calls.
Last edited by Half; Dec 19th, 2005 at 11:08 PM.
-
Dec 21st, 2005, 09:06 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|