本文整理汇总了C++中HANDLE::waitForFinished方法的典型用法代码示例。如果您正苦于以下问题:C++ HANDLE::waitForFinished方法的具体用法?C++ HANDLE::waitForFinished怎么用?C++ HANDLE::waitForFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HANDLE
的用法示例。
在下文中一共展示了HANDLE::waitForFinished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: command
QString ProcessHandle::command() const
{
#ifdef Q_OS_WIN
HANDLE process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, id());
if(!process)
{
throwError("OpenProcessError", tr("Unable to open the process"));
return QString();
}
TCHAR buffer[256];
if(!GetModuleFileNameEx(process, NULL, buffer, 256))
{
throwError("GetModuleFilenameError", tr("Unable to retrieve the executable filename"));
return QString();
}
CloseHandle(process);
return QString::fromWCharArray(buffer);
#else
QProcess process;
process.start(QString("ps h -p %1 -ocommand").arg(id()), QIODevice::ReadOnly);
if(!process.waitForStarted(2000) || !process.waitForReadyRead(2000) || !process.waitForFinished(2000) || process.exitCode() != 0)
{
throwError("GetProcessError", tr("Failed to get the process command"));
return QString();
}
return process.readAll().trimmed();
#endif
}