Full duplex operation, functions C++ C# Windows problem.

Noah Aas 985 Reputation points
2025-04-19T07:09:38.64+00:00

I have an application that does not have a user interface. C# --- C++ So that I can send messages from C# to C++ I must have a window. I don't have the window, I probably only need it because of the data traffic.

How can I easily solve this problem?

protected override void WndProc(ref Message m)
{
	base.WndProc(ref m);
	if (m.Msg == WM_READY_COPYDATA)
	{ 
	
// Parameter:
//   m:
//      Windows-System.Windows.Forms.Message.
[EditorBrowsable(EditorBrowsableState.Advanced)]
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override void WndProc(ref Message m)
{
    switch (m.Msg)
    {
        case 134:

Maybe like this

enter image description here Console in C#, Instance of a test WinForm, ShowDialog -- communication to C++ Looks complicated. What is the opinion of the experts?

Is there an easier way? Can any class inherit from CWnd? And still have the same functionality?I have a control unit that doesn't yet inherit from Window. Can I simply derive it?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,470 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 75,641 Reputation points Moderator
    2025-04-22T16:04:28.72+00:00

    named pipe is probably the easiest to code in C/C++ as it pretty close to plain file I/O. you can also use tcp. a common unix approach is to use stdin and stdout.

    you don't specify what the C/C++ code is doing between these new messages, is it multi-threaded, etc, so its hard to recommend a solution.

    also it was not clear if the C/C++ application was a windows app. if so, your c# app could get the window handle from the process and send a message.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.