Use SComm64 DLL to quickly add Serial Communications capabilities to your .Net applications.
SComm64 is a .Net component which, as the name suggests, is capable of operating in true 64bit mode. But you can also build it into .x86 and 'AnyCPU' projects where it'll operate in whatever mode your own application is targetting. The download includes fully functional sample projects in VB.Net and C# (VS2010)
Comm64 is compatible with MSComm32 in that it uses the same property names, methods and syntax which means that you can quickly add Comm64 to a .Net project using the same syntax that you're used to using with MSComm32.
If you've already got a .Net solution which relies on MSComm32 then you shouldn't have too much trouble removing MSComm and replacing it with SComm64
|
SComm1.CommPort = 23 |
'// Use Any Com Port |
SComm1.Settings = "9600,n,8,1" |
'// Setup the Com Port |
SComm1.PortOpen = True |
'// Open the Port |
|
|
SComm1.Output = "Hello World" |
'// Send some data |
|
|
Do While SComm1.InBufferCount > 0) |
'// Is there any incoming data? |
Text1.AppendText( SComm1.Input) |
'// Receive Data |
Loop |
|
|
|
SComm1.PortOpen = False |
'// Close the port. |
|
|
|
'// Simple ? |
|
|
SComm1.CommPort = 23 |
|
'// Use Any Com Port |
SComm1.Settings = "9600,n,8,1" |
|
'// Setup the com port |
SComm1.PortOpen = True |
|
'// Open the port |
|
SComm1.Output = "Hello World" |
|
'// Send some data |
Do While SComm1.InBufferCount > 0) |
|
'// is there any incoming data? |
Text1.AppendText( SComm1.Input) |
Loop |
|
SComm1.PortOpen = False |
|
'// Close the port |
|
|
'// Simple ?? |
|
But why not use MSComm32 ?
MSComm32 is NOT a .Net component. It's a 32bit OCX. You can use OCX components in .Net projects but .Net Interop wraps them to make two DLL files which you deploy to your users.
Wrapped 32bit ocx components will of course fail if any attempt is made to use them in 64bit application. (Or an 'AnyCPU' mode on a 64 bit OS).
Apart from the problems mentioned above - Anyone who has used MSComm32 for even a short length of time will have identified a number of shortcomings - For example. MSComm32 only supports comports 1 to 16. But serious developers will eventually notice other, more problematic, 'features' where applications become unresponsive or appear to 'freeze' for extended periods (or forever !) as well as unexplained data loss etc.