From: Patrice on

Sorry, we thought you didn't know why those files were opened...

> That' why I need to know who is using that file and I need to send message
> to close it or by programming force to close it.

I don't know and never tried (hopefully someone else will help if possible)
but as I alluded earlier, this is likely a bad idea. In particular the user
could loose his work if you just close his Excel file. Generally your
application should deal with what currently happens rather than to impose
his own will to the whole system (and ultimately to the user).

I would just bypass those files and would process them at a later time. Some
more details about what you are doing with them cold perhaps help.


--
Patrice


From: Nobody on
"Amrit" <cadd(a)wlink.com.np> wrote in message
news:emep$swgKHA.2104(a)TK2MSFTNGP05.phx.gbl...
> Hi
>
> Thanks both of you for reply. Sorry, But I am not looking for it. That is
> external exe by MS.

If the file is located on a network share, then you can use NetFileEnum().
See this VB6 sample:

http://vbnet.mvps.org/code/network/netfileenum.htm

If it's not on a share, then there is no documented way to get the process
that has the file open. The undocumented way is by using
SystemHandleInformation() or NtQuerySystemInformation(). Search the web for
these for more information, but not using them properly may crash your
application and possibly the system.



From: Amrit on
Hi Nobody.



I think it has much option. . it search by machine "NetFileEnum: Get Open
File Info from a Specified Machine" subject it self.

If I am not mistake this give list of open file on machine.

but i need to find User ID, Who has opened That File. I don't' want to loop
for 100 computer to find one file. It Gives Owner, as I understand it is the
UID of computer where the file is.



WELL i am not good for Win API. So I don't know much to manipulate it. i am
not sure if there will be API function which give the UID of computer if the
file is already open.



Like in AutoCAD: for e.g.



Server has all files. And computer AAA has open file. And if computer BBB
tries to open same file, it give message "AAA has opened file". And you will
have option to open file on read-only mode.



That's it.

Thanks for your effort. I really appreciate it.

Amrit






"Nobody" <nobody(a)nobody.com> wrote in message
news:eqNaNFygKHA.2188(a)TK2MSFTNGP04.phx.gbl...
> "Amrit" <cadd(a)wlink.com.np> wrote in message
> news:emep$swgKHA.2104(a)TK2MSFTNGP05.phx.gbl...
>> Hi
>>
>> Thanks both of you for reply. Sorry, But I am not looking for it. That is
>> external exe by MS.
>
> If the file is located on a network share, then you can use NetFileEnum().
> See this VB6 sample:
>
> http://vbnet.mvps.org/code/network/netfileenum.htm
>
> If it's not on a share, then there is no documented way to get the process
> that has the file open. The undocumented way is by using
> SystemHandleInformation() or NtQuerySystemInformation(). Search the web
> for these for more information, but not using them properly may crash your
> application and possibly the system.
>
>
>


First  |  Prev  | 
Pages: 1 2
Prev: VB6 Service can't run .bat file
Next: Replace Better