سؤال

How would I go about starting a Run Dialog window and having my application input a command to start Steam?

I would like my application to open the standard windows run dialog pre-filled with input.

This is what I have tried:

HINSTANCE result;
result = ShellExecute(NULL, "open", "rundll32.exe", "steam://connect/192.69.96.168:27023", NULL, SW_SHOWDEFAULT);

I don't really understand the parameters for ShellExecute and would like some clarification.

UPDATE

I think I have gotten it to work:

HINSTANCE result;
result = ShellExecute(                            // WinExec is obsolete.
    0,                                        // hwnd
    "open",                                   // operation/verb.
    "steam://connect/192.69.96.168:27023",    // executable.
        "",                                        // parameters.
    NULL,                                     // directory
    SW_SHOW);                                 // how to be displayed 
هل كانت مفيدة؟

المحلول

Have a look here, taken from this related question. This will open the run dialog.

Then if your process has the admin rights, you might be able to call SetWindowText on the handle of the input box of the dialog, which you'll find with FindWindowEx or similar.

I really think it's easier to create your own run dialog which looks like the windows one and calls ShellExecute when "ok" is clicked.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top