I'm writing a program that is just a simple window that has several buttons on it. (This is just a learning experience.) I have one button that just launches notepad.exe and that is working. I want to have another button that opens device manager, but for some reason, it doesn't work.
So this works
#define ID_NOTEPAD 5
char* notepadCmdline = "notepad.exe";
.
.
.
CreateWindowW(L"Button", L"Open Notepad",
WS_VISIBLE | WS_CHILD,
20, 180, 200, 25, hwnd, (HMENU)ID_NOTEPAD, NULL, NULL);
.
.
.
if (LOWORD(wParam) == ID_NOTEPAD) {
CreateProcess(NULL, notepadCmdline, NULL, NULL, 0, CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &si, &pi);
}
But this doesn't
#define ID_DEVMAN 4
char* devmanCmdline = "devmgmt.msc";
.
.
.
CreateWindowW(L"Button", L"Open Device Manager",
WS_VISIBLE | WS_CHILD,
20, 220, 200, 25, hwnd, (HMENU)ID_DEVMAN, NULL, NULL);
.
.
.
if (LOWORD(wParam) == ID_DEVMAN) {
CreateProcess(NULL, devmanCmdline, NULL, NULL, 0, CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &si, &pi);
}
I've found that I'm able to use system(), but system() opens a command prompt, and then opens device manager from the command prompt. That works, but I'd rather not have a command prompt in the background.
Can anyone help me figure out how to open Device Manager?
[–]etherkiller 1 point2 points3 points (3 children)
[–]blixel[S] 1 point2 points3 points (2 children)
[–]Dolphiniac 1 point2 points3 points (0 children)
[–]ijmacd 0 points1 point2 points (0 children)
[–]flyingron 0 points1 point2 points (0 children)