win FORM app - How do I connect it to my software

Hi

I have a c++ software. I use visual studio express 2010.
I want to use forms to enter the data into my software , and also make form manual.

I opened win form project. I created Form1. with few buttons.
I saw the Form1.h file, that was generated.

Do I simply call my function from the Event handlers. like this :

private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)

my_func(button3);
}

and then refer to the button handler from my function like this ?

void my_func (System::Windows::Forms::Button ^ button_handl) {
button_handl->Text = L" my own text";
}



Is this the way to do it ?

(Note, I don't need web. it is a console application. )
It is console application and you want to use buttons????
if u can't change the c++ software which you have , i think it's have no idea;
through win32 message ? socket ????
closed account (3hM2Nwbp)
In the first method you posted, System::Object^ sender is the button. You can just cast it to a System::Windows::Forms::Button^ there and work with it rather than calling another method if you want. I don't know which is the preferred way though, windows programming in general has always struck me as somewhat counter-intuitive.
The question was using winform. regarding the refering to the control handlers.
So, this way is ok. also , it seems the best way to call it directly from the event handler.
I found out that winform is not fully supported for c++. So , I need to write the DUI of my software in C#. anybody knows what is the techniuqe to call c++ functions from c# ?

Thanks
Topic archived. No new replies allowed.