Tony
2005-04-04 18:39:01 UTC
How do I make a function written in C++ with Win32 functions work with my
Windows Forms Application written in C# ?
I wrote a function in C++ and tested it as a Win32 console application with
VC6. It includes initialization code and a for (;;) loop to monitor the
status of COM1 discrete input lines via a call to GetCommModemStatus() in the
SDK. When the CTS (COM1 pin 8) or RING (COM1 pin 9) signals goes true, I need
to call a function in a C# class.
I have been reviewing the System.Runtime.InteropServices and
System.Threading functions. All of the type casting is causing me a headache
... and I have written multi-threaded applications in C for Win32. My old
application is running for a couple years without rebooting Windows 2000. I
want to use my proven discrete input technique with this new .NET Windows
Application.
My C++ function is using WaitCommEvent with an OVERLAPPED structure. Do I
need to translate all of this for Interop?
I used C# because it works nicely for the GUI, database, and reports part of
my application.
How does Microsoft suggest to mix languages in this situation?
Windows Forms Application written in C# ?
I wrote a function in C++ and tested it as a Win32 console application with
VC6. It includes initialization code and a for (;;) loop to monitor the
status of COM1 discrete input lines via a call to GetCommModemStatus() in the
SDK. When the CTS (COM1 pin 8) or RING (COM1 pin 9) signals goes true, I need
to call a function in a C# class.
I have been reviewing the System.Runtime.InteropServices and
System.Threading functions. All of the type casting is causing me a headache
... and I have written multi-threaded applications in C for Win32. My old
application is running for a couple years without rebooting Windows 2000. I
want to use my proven discrete input technique with this new .NET Windows
Application.
My C++ function is using WaitCommEvent with an OVERLAPPED structure. Do I
need to translate all of this for Interop?
I used C# because it works nicely for the GUI, database, and reports part of
my application.
How does Microsoft suggest to mix languages in this situation?