Results 1 to 6 of 6

Thread: IFileInuse

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2013
    Posts
    487

    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.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2013
    Posts
    487

    Re: IFileInuse

    Bumping this thread.

  3. #3
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,732

    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?

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2013
    Posts
    487

    Re: IFileInuse

    Quote Originally Posted by fafalone View Post
    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

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,732

    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

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2013
    Posts
    487

    Re: IFileInuse

    Quote Originally Posted by fafalone View Post
    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
  •  



Click Here to Expand Forum to Full Width