Mam taki problem, a mianowicie jak mogę wywołać funkcję z pliku klasy.cpp w tym miejscu pliku Form1.h gdzie jest zakomentowana?
private: System::Void button1_Click(System::Object<sup> sender, System::EventArgs</sup> e) {
//funkcja(); DON'T WORK FUNCTION
}
//Aplikacja1.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
using namespace Aplikacja1;
[STAThreadAttribute]
int main(array<System::String > args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
//Form1.h : header project file
#pragma once
namespace Aplikacja1 {
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>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Button());
this->button2 = (gcnew System::Button());
this->button3 = (gcnew System::Button());
this->SuspendLayout();
//
// button1
//
this->button1->BackColor = System::Turquoise;
this->button1->Location = System::Point(57, 32);
this->button1->Name = L"button1";
this->button1->Size = System::Size(145, 54);
this->button1->TabIndex = 0;
this->button1->Text = L"SAVE";
this->button1->UseVisualStyleBackColor = false;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->BackColor = System::DarkSeaGreen;
this->button2->Location = System::Point(57, 112);
this->button2->Name = L"button2";
this->button2->Size = System::Size(145, 54);
this->button2->TabIndex = 1;
this->button2->Text = L"LOAD";
this->button2->UseVisualStyleBackColor = false;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// button3
//
this->button3->BackColor = System::Chartreuse;
this->button3->Location = System::Point(57, 189);
this->button3->Name = L"button3";
this->button3->Size = System::Size(145, 54);
this->button3->TabIndex = 2;
this->button3->Text = L"CLOSE";
this->button3->UseVisualStyleBackColor = false;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// Form1
//
this->AutoScaleDimensions = System::SizeF(6, 13);
this->AutoScaleMode = System::Font;
this->ClientSize = System::Size(292, 266);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object sender, System::EventArgs e) {
//funkcja(); DON'T WORK FUNCTION
}
private: System::Void button3_Click(System::Object sender, System::EventArgs e) {
this->Close();
}
private: System::Void button2_Click(System::Object sender, System::EventArgs e) {
}
};
}
//klasy.cpp
#include "stdafx.h"
#include <iostream>
using namespace std;
void funkcja()
{
cout<<"Witam"<<endl;
}