"Thiago Guedes" <thiagosguedes@ hotmail.com> wrote in message
news:002401c3a2 25$0f671790$a30 1280a@phx.gbl.. .[color=blue]
> Hi,
> how can I use Serial Port in C#, using a framework native
> code.
> I dont want to use P/Invoke.
>
> Tks,
> Thiago
>[/color]
Using an active X control still means that you will be using interop
code of some sort, and it will actually take more instructions to call the
COM code than it would to call the P/Invoke code.
Even when the System.IO.Ports namespace is introduced, my bet is that it
will just be a managed wrapper calling native code anyways, so you might
want to do this yourself for now, and switch over when the namespace is
introduced.
"news.microsoft .com" <discussion@dis cussion.microso ft.com> wrote in message
news:%23Uvu%23V ioDHA.2512@TK2M SFTNGP09.phx.gb l...[color=blue]
> CraptiveX is the only way at present intil 2004 when we get[/color]
System.IO.Ports[color=blue]
> namespace
>
> http://longhorn.msdn.microsoft.com
>
>
>
> "Thiago Guedes" <thiagosguedes@ hotmail.com> wrote in message
> news:002401c3a2 25$0f671790$a30 1280a@phx.gbl.. .[color=green]
> > Hi,
> > how can I use Serial Port in C#, using a framework native
> > code.
> > I dont want to use P/Invoke.
> >
> > Tks,
> > Thiago
> >[/color]
>
>[/color]
If you are going the MSComm COM interop route, simply add a reference in
your C# project to MSCommLib. Click on the COM
tab and browse to select your MSCOMM32.OCX .
Then create an instance of it in your C# class:
MSCommLib.MSCom m mscomm = new MSCommLib.MSCom mClass();
The MSComm control has been working fine for me however I am still looking
for a better .NET way to do it:
Some alternatives to using the MSComm control in .NET
"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
message news:Owe7uYioDH A.2140@TK2MSFTN GP09.phx.gbl...[color=blue]
> Even when the System.IO.Ports namespace is introduced, my bet is that[/color]
it[color=blue]
> will just be a managed wrapper calling native code anyways, so you might
> want to do this yourself for now, and switch over when the namespace is
> introduced.[/color]
We use this MS source, haven't had any trouble with it. It looks a lot like
Longhorn, so I expect trivial conversion later.
> We use this MS source, haven't had any trouble with it. It looks a[color=blue]
> lot like Longhorn, so I expect trivial conversion later.
>
>[/color]
The above approach does not support Win98 or WinME. It uses
BindIoCompletio nCallback and Windows 95/98/Me are *all* not supported. Of
course .NET does not support Win95 at all.
Also, some methods of the ThreadPool Class are not supported by Win98.
-Ed
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/28/2003
Comment