Talking to a standard serial port

  • Thread starter Thread starter Peter Oliphant
  • Start date Start date
P

Peter Oliphant

Is there a convenient function that will allow reading a standard serial
port (ala the kind that a mouse was typically plugged into before USB came
out)? I can also use DirectX if this would make it easier than without it...

In any case, what do I need to know to talk to a serial port using MS.NET
managed C++ 2005 using old syntax?

Thanks in advance for responses...! : )

[==P==]
 
Thanks Jochen! Do happen to know if there is any sample code available using
the SerialPort class? There is none in MSDN...

[==P==]
 
Cool, thanks! : )

Is this class supported if you use 2005 but with *old syntax*? It doesn't
like the following line (C++):

using namespace System::IO::Ports ;

The compiler claims that Ports doesn't exist as part of System::IO. Do I
need somw sort of include here? For context, my project was initially a 2003
project, I've converted it over to 2005, but kept old syntax. It compiles
and runs provided I keep the black Console screen...

[==P==]
 
Hi Peter!
Is this class supported if you use 2005 but with *old syntax*? It doesn't
like the following line (C++):

using namespace System::IO::Ports ;

The compiler claims that Ports doesn't exist as part of System::IO. Do I
need somw sort of include here? For context, my project was initially a 2003
project, I've converted it over to 2005, but kept old syntax. It compiles
and runs provided I keep the black Console screen...

Maybe it uses the old .NET 1.1 assembly?

Please check your project settings under the "Common Properties" and
verify the you are refering the v2.0 assemblies!

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Hi Jochen,

For some reason it started working (I think I might have added system.dll as
a reference to make it work, which might have brought in Framework 2.0). Or
it could be because I created a new 'using' immediatelt below its root
(i.e., I put "using System::IO:Ports" directly under "using System::IO")...

Thanks! I can now create a SerialPort class instance, so I got my perverbial
'foot in the door'! lol : )

[==P==]

PS - I really do like 2005 the improvements to the GUI, which is why I'm
making the efffort to switch. Also some of the new functionality in 2005 is
very helpful (e.g., Form's DoubleBuffered to elliminate flicker)... : )
 
Back
Top