Here's one approach I'm considering. What do you think:
When I startup the WinForms app I can ensure that there's a temporary
subfolder, like: C:\Temp\AppName I will try to erase all files in it.
When it's time to copy a file to a mobile device I can first use File.Copy
to copy the source file (which seems to work regardless if there's a lock)
into this folder. And if the file already exists, perhaps from a previous
lock, then I'd just add a numeric digit to it until I found a free filename -
like "Filename1.ext", "Filename2.ext", etc.
And then this copy, which I'll know is not locked, I can copy to the mobile
device.
Comments appreciated.
--
Robert W.
Vancouver, BC
www.mwtech.com
"W.G. Ryan eMVP" wrote:
AFAIK, there's no easy way around this - pulling the cable while syncing
sucks - BAD. Let me look around for you but typically it's going to be a
mess if it happens.
W.G. Ryan MVP
Windows Embedded
"Robert W." <Ro*****@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com... I'm writing a WinForms app that copies files to Pocket PC using the RAPI
'CopyFileToDevice' method. If there are no interruptions then everything
works perfectly.
But in testing, I've deliberately disconnected the Pocket PC to see what
happens.
Upon reconnection I get an error that the source file is being used by
another process - in other words, the file is locked.
Since I know the previous process has concluded, is there a way for me to
forcibly unlock the file?
--
Robert W.
Vancouver, BC
www.mwtech.com