|
-
Sep 12th, 2007, 08:26 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Copy file to scanner
I am starting this as a new thread.
Here is what I am doing.
On PC, I create a flat file (Z:\Location.txt)
I want to copy flat file to scanner
On scanner application, I will add a button that displays a grid with the location data loaded.
Should not be too difficult.
My 1st stumbling block is what to do if the file already exists on the scanner (which it will). Here is my code for loading the file.
filename = "Z:\LOCATION.TXT"
'locate the file, and see if it already exists on the device
lngFileHandle = CeFindFirstFile(filename, typFindFileData)
'if we get -1 then the file wasn't found so we can go ahead and create it
'otherwise we dont want to overwrite in this demo, so we will cancel the operation.
'If lngFileHandle <> INVALID_HANDLE Then
' MsgBox filename & " already exists. Operation Cancelled."
' CeFindClose lngFileHandle
' CopyFileToPocketPC = False
'End If
==> The previous bit of code, from a sample, did not want to overwrite the file. I do.
'create the file on the device, and return the handle to the file
'--filename = Form1.txtPPCFile.Text
lngDestinationHandle = CeCreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, vbNullString, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)
'if something went wrong in CeCreateFile we will get -1, and therefore need to abort
If lngDestinationHandle = INVALID_HANDLE Then
MsgBox "CeCreateFile Error " & CeGetLastError & " occurred.", vbCritical & vbOKOnly
CopyFileToPocketPC = False
Exit Function
End If
==> because I did not delete the existing file, I get a 'Create File' error here (error #3).
===================================================
If your question has been answered, mark the thread as [RESOLVED]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|