Skip to content

Instantly share code, notes, and snippets.

@ntropy83
Last active July 17, 2020 06:33
Show Gist options
  • Save ntropy83/b7e653c1eeefc9e68d1ba2cfe7b2d7f5 to your computer and use it in GitHub Desktop.
Save ntropy83/b7e653c1eeefc9e68d1ba2cfe7b2d7f5 to your computer and use it in GitHub Desktop.
win_homeoffice_quicklauncher
#include <windows.h>
VOID startup(LPCTSTR lpApplicationName)
{
// additional information
STARTUPINFO si;
PROCESS_INFORMATION pi;
// set the size of the structures
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// start the program up
CreateProcess( lpApplicationName, // the path
_argv[1], // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)
);
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
int main(int argc, char** _argv) {
startup("PATH_TO_firefox.exe");
startup("PATH_TO_thunderbird.exe");
}
@ntropy83
Copy link
Author

Updated title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment