programming serial CommPort .NetCF for Pocket PC

Christian B

Member
Joined
Aug 5, 2005
Messages
9
Programming Experience
3-5
Hi,

i have to write a tool in vb.net to configure our Hardware via a serialPort.
One Build of the Software has to run on Win32 and WinCe Machines.

For Win32 i have declared the following:
VB.NET:
Private Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" _

(ByVal lpFileName As String, ByVal dwDesiredAccess As Int32, _ 

ByVal dwShareMode As Int32, ByVal lpSecurityAttributes As IntPtr, _

ByVal dwCreationDisposition As Int32, ByVal dwFlagsAndAttributes As Int32, _

ByVal hTemplateFile As IntPtr) As IntPtr
And for WinCe:
VB.NET:
Private Declare Function CreateFileCE Lib "coredll.dll" Alias "CreateFileW" _

(ByVal lpFileName As String, ByVal dwDesiredAccess As Int32, _ 

ByVal dwShareMode As Int32, ByVal lpSecurityAttributes As IntPtr, _

ByVal dwCreationDisposition As Int32, ByVal dwFlagsAndAttributes As Int32, _

ByVal hTemplateFile As IntPtr) As IntPtr
At runtime i decide with
VB.NET:
 System.Environment.OSVersion.Platform
what function call to use.

The Project is completly compiled for CF.

And now the problem:
On Win32 Machines it runs perfectly but under WinCE (Pocket Windows)
CreateFileCe returns no valid CommHandle for Com1 to Com9!

I have heard that there schould be antother App blocking a Port, but I think the Error is another one.

Does anyone can help me to solve this?

Thank you ... Christian
 
HI,
i again...
I have testet FileCreateCE with FileSystem strings as "\program files\test.dat"
too, but the same result
also i have testet to declare FileCreateCe with Alias "FileCreate" or "FileCreateW"

nothing works

I'm really despaired
 
actually to work with above function require coredll.dll to be present in the device ... you may try installing this file.
In the microsoft site itself there will be something called .net runtimes for WinCE.

Cheers ;)

btw, your function looks fine on first sight and i couldn't note anything worng there.
 
Back
Top