Serial port problem again

  • Thread starter Thread starter Jason Jacob
  • Start date Start date
J

Jason Jacob

To all,

Due to some problem, my project can't use the OpenNetCF classes, so
I'll have to use the P/Invoke under the WinCE.Net

now I've got some problems in using the P/Invoke things.
1) after using the CreateFile P/Invoke, I've got a Handle value back
(or IntPtr), but value is a large -ve value, I don't know if this is
the normal case (quite strange)

2) then I've called the SetupComm P/Invoke, the win32 error returned
is 12 --> "the access code is invalid", this time I think this is an
error for sure...
But what's the cause? (is it because the Handle returned is -ve, so
access is not possible ?)

Thanks!

From Jason (Kusanagihk)
 
1) Yes, the handle value can be *anything* and is never 1 or 2 or 3.

2) You've done something wrong. Why don't you just take the declarations
from OpenNETCF for the functions that you need and use them?

Paul T.
 
Hi,

As Paul says, a large negative number is normal.

I don't know why you wouldn't be able to get the OpenNETCF code to work (it
does for me). However, an alternative is CFSerialIO from my homepage. It's
free, also.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004.
 
Back
Top