Witam, od paru dni próbuje znaleźć rozwiązanie jak wywołać funkcję która znajduje się w pliku cpp poprzez plik h.
Chce zaznaczyć że oba pliki mają tą samą nazwę MyForm (cpp i h). Tworzę tą apk w Visual Studio i chce aby po kliknięciu na przycisk wywołała mi się funkcja z cpp ale nie za bardzo wiem jak.
MyForm.h
#pragma once
#include <iostream>
namespace BackUpdater {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Podsumowanie informacji o MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: W tym miejscu dodaj kod konstruktora
//
}
protected:
/// <summary>
/// Wyczyść wszystkie używane zasoby.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private:
/// <summary>
/// Wymagana zmienna projektanta.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Wymagana metoda obsługi projektanta — nie należy modyfikować
/// zawartość tej metody z edytorem kodu.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Cursor = System::Windows::Forms::Cursors::WaitCursor;
this->button1->Location = System::Drawing::Point(95, 69);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(133, 28);
this->button1->TabIndex = 2;
this->button1->TabStop = false;
this->button1->Text = L"Dodaj katalog";
this->button1->UseVisualStyleBackColor = true;
this->button1->UseWaitCursor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(713, 423);
this->Controls->Add(this->button1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
this->Name = L"MyForm";
this->Text = L"MyForm";
this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void listView1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void tableLayoutPanel1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
}
public: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
funkcja1();
}
private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}
MyForm.cpp
#include "MyForm.h"
#include <string>
using namespace System;
using namespace System::Windows::Forms;
using std::string;
void funkcja1() {
}
[STAThread]
void main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
BackUpdater::MyForm form;
Application::Run(%form);
}