Open ports with Windows Mobile 6

  • Thread starter Julián Sanz García
  • Start date
J

Julián Sanz García

Hi,

I am developping a demo application that only open a port with CreateFile
method and read port data with ReadFile method.
When i open the com port, a read thread start. This thread has a while loop
which has the ReadFile call. My application fails when this loop try to make
the 5 iteration to ReadFile method call.
I think the exception throws is an access violation exception (0xc0000005)

Can anybody help me?

Thanks
 
G

Ginny Caughey [MVP]

The easiest way to read from a serial port in a managed code app is to use
the Ports.IO.Serial class. Certainly you can use CreateFile, ReadFile, etc.,
but the Serial class has already done the work including managing the worker
thread.
 
D

Dick Grier

Is this serial port code? If so, then you should use the built-in
System.IO.Ports class -- there can be reasons to write your own code, but
this would be unusual. If not serial port code, then you will have to
provide more details.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top