Re: CeGetFileAttributes always fails
From: Doug Forster (doug_ZAPTHIS_AT_ZAPTHIS_TONIQ_DOT_CO_DOT_NZ)
Date: 12/15/04
- Next message: Craigb: "Programming a digital camera"
- Previous message: Floodguy: "Re: Forms - Dialogs"
- In reply to: Benjamin Lukner: "CeGetFileAttributes always fails"
- Next in thread: Benjamin Lukner: "Re: CeGetFileAttributes always fails"
- Reply: Benjamin Lukner: "Re: CeGetFileAttributes always fails"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Dec 2004 15:28:09 +1300
Hi Benjamin,
I'm not a VB programmer so I don't know how VB deals with UNICODE, but I'd
be willing to bet that thats your problem. CE expects UNICODE strings.
Cheers
Doug Forster
"Benjamin Lukner" <Benjamin.Lukner_at_trinomix.de@mp3mounter.de> wrote in
message news:eJHo90f4EHA.3820@TK2MSFTNGP11.phx.gbl...
> Hi!
>
> I'm trying to write a little sync app with VisualBasic 6 and took the
> sample code from Q307256. Connecting to the device and copying files works
> fine.
>
> But if I try to check if a file exists via CeGetFileAttributes I get -1.
> CeGetLastError returns 2:File not found. If I try CeFindFirstFile I also
> get -1 (Invalid Handle) with error 18: No more files. I also tried "\*",
> but that worked neither. Can anybody tell me if there's a fault in my
> code?
>
> I tested it with Windows XP Pro SP2 and ActiveSync 3.7.1
> Devices: Pocket PC 2002, Windows Mobile 2003 and Windows CE 4.1
>
> (Not included is the code for connecting to the device via CeRapiInitEx)
>
> Thanks in advance
>
>
> Public Const MAX_PATH = 260
>
> Public Type FILETIME
> dwLowDateTime As Long
> dwHighDateTime As Long
> End Type
>
> Public Type WIN32_FIND_DATA
> dwFileAttributes As Long
> ftCreationTime As FILETIME
> ftLastAccessTime As FILETIME
> ftLastWriteTime As FILETIME
> nFileSizeHigh As Long
> nFileSizeLow As Long
> dwOID As Long
> cFileName As String * MAX_PATH
> End Type
>
> Public Declare Function CeFindFirstFile Lib "rapi.dll" ( _
> ByVal lpFileName As String, _
> lpFindFileData As WIN32_FIND_DATA) As Long
>
> Public Declare Function CeFindClose Lib "rapi.dll" ( _
> ByVal hFindFile As Long) As Long
>
> Public Declare Function CeGetFileAttributes Lib "rapi.dll" ( _
> ByVal lpFileName As String) As Long
>
>
> Public Function CeFileExists(sFile As String) As Boolean
>
> Dim uRet As WIN32_FIND_DATA
> Dim hFind As Long
>
> hFind = CeFindFirstFile(sFile, uRet)
>
> If hFind = INVALID_HANDLE_VALUE Then
> CeFileExists = False
> Else
> CeFindClose hFind
> CeFileExists = True
> End If
>
> End Function
>
>
> If CeFileExists("\*") Then
> msgbox("OK")
> end if
>
> OR
>
> If CeGetFileAttributes("\test.dat") <> -1 Then
> msgbox("OK")
> end if
>
>
> Kind regards,
>
> Benjamin Lukner
- Next message: Craigb: "Programming a digital camera"
- Previous message: Floodguy: "Re: Forms - Dialogs"
- In reply to: Benjamin Lukner: "CeGetFileAttributes always fails"
- Next in thread: Benjamin Lukner: "Re: CeGetFileAttributes always fails"
- Reply: Benjamin Lukner: "Re: CeGetFileAttributes always fails"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|