int exitCode = QProcess::execute("ping", QStringList() << "-c1" << "hostname");if (0 == exitCode) { // it's alive} else { // it's dead}参数可能会有所不同.例如,我相信它将在Windows上为ping -n 1 "hostname".该示例应适用于大多数非Windows版本.Arguments may vary. For example, I believe it would be ping -n 1 "hostname" on Windows. The example should work on most non-Windows versions. 这篇关于如何使用Qt检查计算机的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-26 16:50