3

I am trying to open device manager from a button on Qt Windows app.

What I tried: Assigned the slot/signal to the button. And the method:

 QProcess *proc = new QProcess(this);
    QString cmdStr = "devmgmt.msc";
    proc->start(cmdStr);
    qDebug() << "btn clicked";

But nothing happens when I click it. btn clicked is displayed in console tho.

Edit: I tried also

cmdStr="mmc devmgmt.msc"

But also unable to open.

GeneCode
  • 7,545
  • 8
  • 50
  • 85

1 Answers1

3

Ok managed to get it to work by using QDesktopServices.

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/devmgmt.msc", QUrl::TolerantMode));

And here are a list of other windows app that you might be interested:

System Info

Command Prompt

QProcess::startDetached("\"C:\\Windows\\System32\\cmd.exe\"");

Control Panel

QProcess::startDetached("\"C:\\Windows\\System32\\control.exe\"");

Magnifier

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Magnify.exe", QUrl::TolerantMode));

Registry Edit

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/regedt32.exe", QUrl::TolerantMode));

Services

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/services.msc", QUrl::TolerantMode));

System Info

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/msinfo32.exe", QUrl::TolerantMode));

Settings

QDesktopServices::openUrl(QUrl("file:///C:/settings", QUrl::TolerantMode));

Explorer

system("explorer.exe");

Task Manager

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Taskmgr.exe", QUrl::TolerantMode));

Disk Cleanup

QProcess::startDetached("\"C:\\Windows\\System32\\cleanmgr.exe\"");

MsConfig

system("C:/Windows/System32/msconfig.exe");

Windows Remote

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/msra.exe", QUrl::TolerantMode));

Resource Monitor

QProcess::startDetached("\"C:\\Windows\\System32\\resmon.exe\"");

System Repair Discs

system("C:/Windows/System32/recdisc.exe");

Memory Diagnostics

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/MdSched.exe", QUrl::TolerantMode));

System Restore

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/rstrui.exe", QUrl::TolerantMode));

Startup Folder

QDesktopServices::openUrl(QUrl("file:///C:/Users/dclar.DESKTOP-JTNNAGR/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup", QUrl::TolerantMode));

Run Command

system("c:/windows/system32/rundll32.exe shell32.dll,#61");

Drive Optimization

QProcess::startDetached("\"C:\\Windows\\System32\\dfrgui.exe\"");

Disk Managment

system("C:/Windows/System32/diskmgmt.msc");

Computer Managment

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/CompMgmtLauncher.exe", QUrl::TolerantMode));

Text Tuner

QProcess::startDetached("\"C:\\Windows\\System32\\cttune.exe\"");

Computer Services

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/dcomcnfg.exe", QUrl::TolerantMode));

Device Manager

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/devmgmt.msc", QUrl::TolerantMode));

Direct X Diagnostics

QProcess::startDetached("\"C:\\Windows\\System32\\dxdiag.exe\"");

File History

QProcess::startDetached("\"C:\\Windows\\System32\\FileHistory.exe\"");

Blue Tooth Transfer

QProcess::startDetached("\"C:\\Windows\\System32\\fsquirt.exe\"");

Add Hardware

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/hdwwiz.exe", QUrl::TolerantMode));

Disc Label

QProcess::startDetached("\"C:\\Windows\\System32\\label.exe\"");

Language Installer

QProcess::startDetached("\"C:\\Windows\\System32\\lpksetup.exe\"");

Malicious Software remover

QProcess::startDetached("\"C:\\Windows\\System32\\MRT.exe\"");

Narrator

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Narrator.exe", QUrl::TolerantMode));

User Accounts

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Netplwiz.exe", QUrl::TolerantMode));

Windows Backup

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/sdclt.exe", QUrl::TolerantMode));

Create Shared Folders

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/shrpubw.exe", QUrl::TolerantMode));

System Shutdown

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/shutdown.exe", QUrl::TolerantMode));

Sticky Notes

QProcess::startDetached("\"C:\\Windows\\System32\\StikyNot.exe\"");

System Reset

QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/systemreset.exe", QUrl::TolerantMode));

Ease Of Access

QProcess::startDetached("\"C:\\Windows\\System32\\Utilman.exe\"");

Word Pad

QProcess::startDetached("\"C:\\Windows\\System32\\write.exe\"");
GeneCode
  • 7,545
  • 8
  • 50
  • 85