开发者

Programmatically open System Information

I am trying to programmatically 开发者_如何学Goopen Window's "System Information" across different Window's version. At the moment it involves opening a cmd.exe window which then finds "System Information".

The problem is that I have an extraneous black command-line window while the "System Information" is open. Is there a way of doing without this extra window?


It is a known app, like Wordpad, the reason that cmd.exe can find it. Just use ShellExecute to open msinfo32.exe. For example:

#include <shellapi.h>
#pragma comment(lib, "shell32.lib")
...
// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        if (LOWORD(wParam) == IDC_INFO) {
            ShellExecute(hDlg, L"open", L"msinfo32.exe", 0, 0, SW_SHOWNORMAL);
            break;
        }
    // etc..
}

Which assumes you added a button to the About dialog with identifier IDC_INFO.


See How to start the Microsoft System Information dialog on codeproject.


Accessing MSInfo32 programmatically is explained in How to start the Microsoft System Information dialog

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜