// Windows form.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
usingnamespace Windows form;
void Search()
{
Process::Start("IExplore.exe", "http://youtube.com/");
}
[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;
}
and then there is Form1.cpp
all you need to know about form1.cpp is that i did this
When you double click on the button in the form designer it will generate the click function, add your search function below it. Also there is little reason to add any code to the <project_name>.cpp file, Windows form.cpp in your case. It is the entry point of the app and really only starts the form
1 2
// Create the main window and run it
Application::Run(gcnew Form1());
anything you do in that file will only happen either before the form opens or after it closes. You can do what coder777 suggested and put you functions in a seperate header, but I usually find it easiest to just add (simple) code to Form1.h