Probably the easiest way is just trying to open it and trapping the error. So
assuming you know the file exists then
lnHandle = fopen(lcMyFileName)
if lnHandle = -1
* -- The file couldn't be opened so is open somewhere else.
else
fclose(lnHandle)
endif
To close it you would have to find the file handle from the other process, i.e.
whatever they're using to read PDF files, and use the Windows API to close that
handle. Bearing in mind that they could be using any web browser, Acrobat
Reader or any number of PDF readers to view the PDF. Maybe extract it in their
temp folder and don't worry about erasing it.
--
Alan Bourke
alanpbourke (at) fastmail (dot) fm
On Tue, 29 Mar 2022, at 4:33 PM, Carl Lindner wrote:
> I extracted "d:\test_dir\test.pdf". Then used ShellExecute to open it. The
> user reads the pdf and later I want to erase it. But, it will not erase if
> the user has not previously closed it.
>
>
>
> How can I tell if it is closed? Even better, is there a way I can close it?
>
>
>
> Carl Lindner
>
>
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> text/plain (text body -- kept)
> text/html
> ---
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.