Skip to content

Instantly share code, notes, and snippets.

@AlexBolotsin
Created October 9, 2016 16:37
Show Gist options
  • Save AlexBolotsin/8377d9a00f85c1cf6fdda184bb19d835 to your computer and use it in GitHub Desktop.
Save AlexBolotsin/8377d9a00f85c1cf6fdda184bb19d835 to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <iostream>
int main()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
if (!CreateProcess(L"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
L"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
std::cout << "Error! " << GetLastError() << "\n";
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment