SHRunFileDialog (shell32)
Last changed: -149.254.200.222

.

Opens the typical 'Run' dialog used by the start menu, without explorer.exe.

C# Signature:

[DllImport("shell32.dll", CharSet=CharSet.Auto, EntryPoint="#61", SetLastError=true)]
static extern bool SHRunFileDialog(IntPtr hwndOwner, IntPtr hIcon, string lpszPath, string lpszDialogTitle, string lpszDialogTextBody, RunFileDialogFlags uflags);

User-Defined Types:

    [Flags()]
    public enum RunFileDialogFlags : uint
    {
        /// <summary>
        /// Don't use any of the flags (only works alone)
        /// </summary>
        None = 0x0000,
        /// <summary>
        /// Removes the browse button
        /// </summary>
        NoBrowse = 0x0001,
        /// <summary>
        /// No default item selected
        /// </summary>
        NoDefault = 0x0002,
        /// <summary>
        /// Calculates the working directory from the file name
        /// </summary>
        CalcDirectory = 0x0004,
        /// <summary>
        /// Removes the edit box label
        /// </summary>
        NoLabel = 0x0008,
        /// <summary>
        /// Removes the seperate memory space checkbox (Windows NT only)
        /// </summary>
        NoSeperateMemory = 0x0020    
    }

Alternative Managed API:

Use the Documented IShellDispatch->Run(), but this can be a pain in C# if you are pressed for time.

Notes:

None.

Tips & Tricks:

You can pass zero or more flags to the function. If the function fails, check your character encoding. It seems that it expects Unicode characters by default.

Sample Code:

        string path;
        string dialogtitle;
        string dialogtext;

        path = "C:\\WiNDOWS";
        dialogtitle = "Start Application";
        dialogtext = "Enter the name of the program file you wish to run.  You may also enter in URLs and items found in your path and applications list.";

        SHRunFileDialog(
        this.Handle,
        this.Icon.Handle,
        path,
        dialogtitle,
        dialogtext,
        RunFileDialogFlags.CalcDirectory
        );

Submitted by Gabriel Sharp (http://paradisim.net)

Documentation
Undocumented by Microsoft - Thanks to Armen Hakobyan for his article on codeproject