-
Feb 28th, 2021, 05:32 AM
#1
Thread Starter
Fanatic Member
IFileInuse
I am experimenting with the IFileInUse interface which allows you to know which application is currently using\locking a file.
But before going any further, I have a couple of questions :
1- Will this interface work on files opened in a remote computer ?
2- If the answer to question (1) is yes, can I retrieve the "username" of the user that has the file open in the remote computer ?
Could the IFileIsInUse::GetSwitchToHWND be used to get the remote application hwnd, and from the hwnd get the PID, and finally, get the username from the PID ?
Does anybody know ?
Thanks.
-
Mar 1st, 2021, 01:11 PM
#2
Thread Starter
Fanatic Member
-
Mar 1st, 2021, 07:01 PM
#3
Re: IFileInuse
I'm not sure about the question, but wanted to note that you'll only be able to get that interface if the file is in use by an application that specifically implements the IFileInUse interface, and most don't. Are you looking to see if it's locked by a specific application you know supports this interface?
-
Mar 1st, 2021, 07:47 PM
#4
Thread Starter
Fanatic Member
Re: IFileInuse
Originally Posted by fafalone
I'm not sure about the question, but wanted to note that you'll only be able to get that interface if the file is in use by an application that specifically implements the IFileInUse interface, and most don't. Are you looking to see if it's locked by a specific application you know supports this interface?
The application is going to be either MS Excel or MS Word. I am not sure if these applications do implement the IFileIsInUse interface.
But even if they do support this interface, will the interface be of any use for finding out the username that is using\locking the file in a remote computer ?
The interface exposes 5 functions none of which seem to offer a way for getting the username who is currently using the file.
Thanks
-
Mar 4th, 2021, 04:58 PM
#5
Re: IFileInuse
The interface itself doesn't tell you the username, no. Once you know the file is in use you'd have to find that info out using other methods.
If it's Office I believe it creates a .lockfile that contains the username, or a temp file:
https://stackoverflow.com/questions/...ing-access-vba
-
Mar 8th, 2021, 05:27 AM
#6
Thread Starter
Fanatic Member
Re: IFileInuse
Originally Posted by fafalone
The interface itself doesn't tell you the username, no. Once you know the file is in use you'd have to find that info out using other methods.
If it's Office I believe it creates a .lockfile that contains the username, or a temp file:
https://stackoverflow.com/questions/...ing-access-vba
Thank you fafalone for answering
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
|