Visual Studio C++, WinForms, Add external class to project


I have started a project with Visual Studio. I am creating a GUI with WinForms. My goal is to click the button and start an external class/function in C++/CLI.

Currently the GUI is locking like this:

enter image description here

The Code in Forms.h is:

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


        this->button1->Text = L"Start Function";
        MyFunction Func;
        Func.start();

    }

I have added myfunction.h to the project. It is currently locking like this:

class MyFunction
{
public:


    bool start() {

               any code...
                   MessageBox(0, L"Button clicked!",  L"Button clicked",  MB_OK | MB_ICONEXCLAMATION);

    }
};

How can I get the MyFunction running after I clicked the button ?

Leave a Reply

Your email address will not be published. Required fields are marked *