[RESOLVED] Program Not Able to See File on PocketPC
I am maintaining code that is used to traverse through a directory on a Pcocket PC handheld scanner, and detect if there is a file available to be uploaded. The function below is the code that traverses through the directories:
Code:
Public Function CheckFileExistence(strFileName As String) As Boolean
On Error GoTo ErrHandler
Dim bytBuffer(200000) As Byte
Dim lngFileHandle As Long
Dim lngBytesRead As Long
Dim typFindFileData As CE_FIND_DATA
Dim intFreeFileID As Integer
Dim intWriteLoop As Integer
Dim strRemoteFileName As String
strRemoteFileName = strFileName
'Check the existence of the file on the device
lngFileHandle = CeFindFirstFile(strRemoteFileName, typFindFileData)
If lngFileHandle = INVALID_HANDLE Then
CheckFileExistence = False
Else
CheckFileExistence = True
End If
Exit Function
ErrHandler:
Err.Raise CeGetLastError, Err.Source, Err.Description
End Function
I did tweaked some code earlier that SHOULD not have anything to do with as it is in the Form Load sub procedure and does not update any global variables.
Old Code:
Code:
intResponse = MsgBox("Is the scanner connected to the PC?", vbYesNo + vbApplicationModal + vbQuestion, "Confirm")
If intResponse = vbNo Then End
intRetVal = CeRapiInit()
If intRetVal <> INIT_SUCCESS Then
MsgBox "Failed to initialise RAPI with device with error " & _
CeGetLastError
CeRapiUninit
End
End If
New Code:
Code:
If CeGetDeviceId() = False Then
Dim num As Integer
num = MsgBox("Handheld scanner not detected. Exiting ScanTransferV3 application.", vbCritical, "CeGetDeviceId() Failed")
End
End If
I'm lost on this one?? Thanks for any suggestions or help!
Re: Program Not Able to See File on PocketPC
On second thought, I did add a reference to a DLL file called ceutil.dll to call the CEGetDeviceId() function. There is a reference to a DLL called CERAPI that the CeFindFirstFile() function is a part of. Could it be that with the inclusion of the second DLL (ceutil.dll) it is disrupting the previous DLL file (CERAPI.dll)?? Just a thought
Re: Program Not Able to See File on PocketPC
Well it seems I answered my own question this time. There was a function call to the CeRapiInit function that was in the old code, which needed to be included in the new code as well. This function initializes the connection between the hand held device and the computer.