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.
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.MSComm mscomm = new MSCommLib.MSCommClass();
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
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.
The above approach does not support Win98 or WinME. It uses
BindIoCompletionCallback 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
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.