|
-
Jan 23rd, 2006, 05:14 AM
#1
Thread Starter
Member
Retrieve the Path of a File open by an EXE !!
Is there a way of getting the qualified name (ie full path + name) of a file that is currently open by an foreign application without using Automation.
So for example, let's say a running instance of Excel has a workbook open. How can I get ,from my VB application, the full path of this WorkBook file ?
As I said , I don't want to use Automation with which I could easily use the VB GetObject function .This is because I need this for other applications that do not support Automation.
I assume this could be solved via some API programming..well I hope so
Hope this make sense.
Any takers.
-
Jan 23rd, 2006, 09:56 AM
#2
Re: Retrieve the Path of a File open by an EXE !!
In general, it isn't possible.
Many programs open files but do not lock them, they just load the data at one point and save it at another.
If the file stays locked then presumably you will be able to track down the application using a few API calls (I don't know which I'm afraid), but are unlikely to be able to do it the other way around.
Why are you wanting to do this?
-
Jan 23rd, 2006, 06:06 PM
#3
Lively Member
Re: Retrieve the Path of a File open by an EXE !!
investigate this decleration:
VB Code:
Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
i've never used it though, but i have read about it a little.
-
Jan 23rd, 2006, 07:06 PM
#4
Re: Retrieve the Path of a File open by an EXE !!
That is used to show the "Open" common dialog I'm afraid.
-
Jan 23rd, 2006, 07:10 PM
#5
Lively Member
Re: Retrieve the Path of a File open by an EXE !!
lol, i doubt it helped then.
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
|