Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qprocess-createprocessargumentsmodifier.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QProcess>
5#include <QtCore/qglobal.h>
6
7#ifdef Q_OS_WIN
8#include <QtCore/qt_windows.h>
9
10int main(int argc, char *argv[])
11{
12//! [0]
13 QProcess process;
14 process.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *args)
15 {
16 args->flags |= CREATE_NEW_CONSOLE;
17 args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES;
18 args->startupInfo->dwFlags |= STARTF_USEFILLATTRIBUTE;
19 args->startupInfo->dwFillAttribute = BACKGROUND_BLUE | FOREGROUND_RED
20 | FOREGROUND_INTENSITY;
21 });
22 process.start("C:\\Windows\\System32\\cmd.exe", QStringList() << "/k" << "title" << "The Child Process");
23//! [0]
24}
25#endif