HELP! HELP!! Can't use SerialPort Class to open COM10 or higher

B

BenRu

CE5.0
..Net CompactFramework 2.0 sp1

Try

Dim com10 As New SerialPort("COM10", 115200, Parity.None,
8, StopBits.One)

com10.Open()
com10.WriteLine("1234567890")
com10.Close()
Catch ex As Exception
System.Console.WriteLine(ex.Message)
End Try

I tried "$device\COM10" and "COM10:" ... still failed.

How can I open it?

Got messages below,

An error message cannot be displayed because an optional resource
assembly conta
ining it cannot be found.
 
P

Paul G. Tobey [eMVP]

There's no such thing as COM10 and higher in Windows CE. Windows CE only
allows 10 device names for each prefix. So, for "COM", you can have COM0
through COM9, but no others. So, since this is an operating system
limitation, I would infer that you don't have a COM10. Contact the device
vendor and ask them how to open ports that would normally be numbered, on a
PC, say, COM10 and higher. Once you have the device name, use that in your
SerialPort constructor.

Paul T.
 
B

BenRu

Dear Paul,

We had modified "PRIVATE\device\" source code to support COM10+ , and
we can also open it using eVC4++ application.
But the .NetCF2.0 seems throws error before entering to Win32 API.


Paul G. Tobey [eMVP] 寫é“:
 
P

Paul G. Tobey [eMVP]

Then it's your problem, isn't is. You've changed how the OS works (or
doesn't work). From that point on, I'd say that any problems fall squarely
in your lap. You're passing a string that's one byte longer than standard.
Maybe the .NET CF terminates the string or error-checks it before passing it
on.

Paul T.

Dear Paul,

We had modified "PRIVATE\device\" source code to support COM10+ , and
we can also open it using eVC4++ application.
But the .NetCF2.0 seems throws error before entering to Win32 API.


Paul G. Tobey [eMVP] ??:
 
B

BenRu

Dear Paul,

Thanks.
If like you said, all of the WinCE5.0 devices could not be more than
10.

Can you suggest the MS to support it?
I think it is usually to be used more than 10.
That's "make sense" in the embedded world.


Paul G. Tobey [eMVP] 寫é“:
Then it's your problem, isn't is. You've changed how the OS works (or
doesn't work). From that point on, I'd say that any problems fall squarely
in your lap. You're passing a string that's one byte longer than standard.
Maybe the .NET CF terminates the string or error-checks it before passingit
on.

Paul T.

Dear Paul,

We had modified "PRIVATE\device\" source code to support COM10+ , and
we can also open it using eVC4++ application.
But the .NetCF2.0 seems throws error before entering to Win32 API.


Paul G. Tobey [eMVP] ??:
There's no such thing as COM10 and higher in Windows CE. Windows CE only
allows 10 device names for each prefix. So, for "COM", you can have COM0
through COM9, but no others. So, since this is an operating system
limitation, I would infer that you don't have a COM10. Contact the device
vendor and ask them how to open ports that would normally be numbered, on
a
PC, say, COM10 and higher. Once you have the device name, use that in
your
SerialPort constructor.

Paul T.
 
G

Guest

CE has never supported more than 10. It's how device.exe works - you get a
3-character prefix and an single digit index. If you want more ports, you
use a different prefix. For example you sould do COM0-9, then maybe SER0-9
to give you 20 ports.

-Chris


Dear Paul,

Thanks.
If like you said, all of the WinCE5.0 devices could not be more than
10.

Can you suggest the MS to support it?
I think it is usually to be used more than 10.
That's "make sense" in the embedded world.


Paul G. Tobey [eMVP] ??:
Then it's your problem, isn't is. You've changed how the OS works (or
doesn't work). From that point on, I'd say that any problems fall
squarely
in your lap. You're passing a string that's one byte longer than
standard.
Maybe the .NET CF terminates the string or error-checks it before passing
it
on.

Paul T.

Dear Paul,

We had modified "PRIVATE\device\" source code to support COM10+ , and
we can also open it using eVC4++ application.
But the .NetCF2.0 seems throws error before entering to Win32 API.


Paul G. Tobey [eMVP] ??:
There's no such thing as COM10 and higher in Windows CE. Windows CE
only
allows 10 device names for each prefix. So, for "COM", you can have
COM0
through COM9, but no others. So, since this is an operating system
limitation, I would infer that you don't have a COM10. Contact the
device
vendor and ask them how to open ports that would normally be numbered,
on
a
PC, say, COM10 and higher. Once you have the device name, use that in
your
SerialPort constructor.

Paul T.
 
P

Paul G. Tobey [eMVP]

No, I don't think that this is important *at all*. I'd much rather have
Microsoft work on other things. Use the device\ namespace or, as Chris
suggests, create a second prefix group for the next ten ports.

Paul T.

Dear Paul,

Thanks.
If like you said, all of the WinCE5.0 devices could not be more than
10.

Can you suggest the MS to support it?
I think it is usually to be used more than 10.
That's "make sense" in the embedded world.


Paul G. Tobey [eMVP] ??:
Then it's your problem, isn't is. You've changed how the OS works (or
doesn't work). From that point on, I'd say that any problems fall
squarely
in your lap. You're passing a string that's one byte longer than
standard.
Maybe the .NET CF terminates the string or error-checks it before passing
it
on.

Paul T.

Dear Paul,

We had modified "PRIVATE\device\" source code to support COM10+ , and
we can also open it using eVC4++ application.
But the .NetCF2.0 seems throws error before entering to Win32 API.


Paul G. Tobey [eMVP] ??:
There's no such thing as COM10 and higher in Windows CE. Windows CE
only
allows 10 device names for each prefix. So, for "COM", you can have
COM0
through COM9, but no others. So, since this is an operating system
limitation, I would infer that you don't have a COM10. Contact the
device
vendor and ask them how to open ports that would normally be numbered,
on
a
PC, say, COM10 and higher. Once you have the device name, use that in
your
SerialPort constructor.

Paul T.
 

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