The standard way is system
-- works pretty much anywhere, but gives you no control over how the child process runs.
In ascending order of control (and complexity), Windows provides: WinExec
, ShellExecute
, ShellExecuteEx
, and CreateProcess
. With CreateProcess you pass a STARTUPINFO
or STARTUPINFOEX
structure. Either way, you can specify the starting position and/or size for the child window (though the child process can and may move/resize its window before it's even visible).
You might also want to consider Boost Process
, which isn't accepted as an official part of Boost, but provides a bit more control than system
, while remaining reasonably portable to a fair number of the most widely used systems (including both Windows and anything reasonably POSIX-like, such as Linux or OS X).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…