Console Applications, message pumps, interthread comms
I'm new to the world of C#, my current employer wants me to write a program in C# (VS2008 .NET 3) when normally I'd use VC++.
The code that I'm writing has no GUI but will have several threads which need to communicate with each other. The code for one of these will be provided by a COM DLL.
I have several questions:
1. What is the best method for inter-thread comms and data transfer in C#?
2. In the case of user defined windows message handling, is there a C# equivalent of the PeekMessage pump style code?
3. Is there an equivalent to SendMesssage and PostMessage in C#.
4. If the COM DLL is written using unmanaged code (VC++ version 6) will I encounter any problems when referring to it in C# or does C# behave similarly to VB in this respect.
Any answers or references would be most helpful.
Cheers.
Re: Console Applications, message pumps, interthread comms
Quote:
Originally Posted by brandwooddixon
I'm new to the world of C#, my current employer wants me to write a program in C# (VS2008 .NET 3) when normally I'd use VC++.
The code that I'm writing has no GUI but will have several threads which need to communicate with each other. The code for one of these will be provided by a COM DLL.
I have several questions:
1. What is the best method for inter-thread comms and data transfer in C#?
2. In the case of user defined windows message handling, is there a C# equivalent of the PeekMessage pump style code?
3. Is there an equivalent to SendMesssage and PostMessage in C#.
4. If the COM DLL is written using unmanaged code (VC++ version 6) will I encounter any problems when referring to it in C# or does C# behave similarly to VB in this respect.
Any answers or references would be most helpful.
Cheers.
Questions back to you.
1) How did you do this in C++?
2) Although you can pInvoke to these messaging api's generally you use delegates and events in C# (rather than sending messages).
3) Pinvoke to these, but see 2).
4) If it was in VB (via IDispatch), it should work in C#.