Gut Posted April 14, 2009 Share Posted April 14, 2009 I am having a problem with my app. Currently it is shared between multiple people on a single server install. It lists a directories content in a List box and when clicked, it will preview the pdf in an IE control embedded on a GUI. I tried the adobe control, but found it to buggy. Once previewed the use has the option to save the document to another location. The problem is that if someone else is previewing the file also, the file will not move and becomes locked and cannot delete unless I kill the process and delete manually from the directory. Any ideas on how I can check to see if a file is in use before allowing them to preview it? Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 14, 2009 Share Posted April 14, 2009 You could try _WinAPI_CreateFile and try to open it exclusively first. If that fails then you can assume that your move file function will also fail ... [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Gut Posted April 14, 2009 Author Share Posted April 14, 2009 I thought about that, but multiple people can view it at the same time, no problem. It just seems to be with the save part. And the weird part is that it doesn't give an error like I thought it would. It just doesn't move. or sometimes it does move, but leaves the original too. Link to comment Share on other sites More sharing options...
Gut Posted April 14, 2009 Author Share Posted April 14, 2009 You could try _WinAPI_CreateFile and try to open it exclusively first. If that fails then you can assume that your move file function will also fail ...Sorry, I misread your post. I will try that and let you know how I make out. Link to comment Share on other sites More sharing options...
KaFu Posted April 14, 2009 Share Posted April 14, 2009 Take a look at Siao's example in my Signature for FileInUse() OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now