Launching A Web Page In A Browser

System::Diagnostics::Process::Start("http://www.ibexuk.com");

Opening file in Notepad


	using namespace System::Diagnostics;

	ProcessStartInfo ^startInfo = gcnew ProcessStartInfo();
	startInfo->FileName = "C:\\Windows\\notepad.exe";
	startInfo->Arguments = "\"" + Path::GetDirectoryName(Application::ExecutablePath) + "\\SomeDocName.Config\"";
	Process::Start(startInfo);

Launching Another Application From C++


using namespace System::Diagnostics;
	Process::Start("C:\\GVNVR\\ViewLog500.exe");

	//or
	System::Diagnostics::Process::Start("C:\\GVNVR\\ViewLog500.exe");
If you need to pass arguments then use

	ProcessStartInfo ^startInfo = gcnew ProcessStartInfo();
	startInfo->FileName = "C:\\Program Files\\IndigoVision\\Control Center\\ControlCenter.exe";
	startInfo->Arguments = "-username adampulley -video_display_mode video_panes_only";
	Process::Start(startInfo);

Also see:
Shell Execute

Launching and Closing Another Application From C++

Create Class

	Process^ MyProcess;
Open Ap

	MyProcess = gcnew Process();
	MyProcess->StartInfo->FileName = "C:\\Program Files\\IndigoVision\\ControlCenter.exe";
	MyProcess->StartInfo->Arguments = "-username adampulley -video_display_mode video_panes_only";
	MyProcess->Start();
Close Ap

	if (MyProcess != nullptr)
	{
		if (!MyProcess->HasExited)
			MyProcess->CloseMainWindow();
		MyProcess = nullptr;
	}

Other resources for fingding and closing other aps:
http://support.microsoft.com/kb/307395

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

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