- 1 year ago
QProcess start Notepad++ with Windows "start" program
Comment
1 / 1
To start Notepad++ using the Windows start
program from a QProcess
object in Qt, you can use the following code:
cppQStringList arguments;
arguments << "/B" << "start" << "notepad++.exe" << "/wait";
QProcess *process = new QProcess(this);
process->start("cmd", arguments);
Here, we create a QStringList
containing the arguments to be passed to the cmd
command, which in turn will execute the start
program with the appropriate parameters. The /B
flag tells cmd
to run the command in the current window, and the /wait
flag tells start
to wait for the program to exit before returning.
Then, we create a QProcess
object and start the cmd
process with the arguments we just created.
This should start Notepad++ using the start
program, and wait for it to exit before returning control to your program.