ShellExecute (shell32)
Last changed: -188.102.225.40

.
Summary

C# Signature:

[DllImport("shell32.dll")]
static extern IntPtr ShellExecute(
    IntPtr hwnd,
    string lpOperation,
    string lpFile,
    string lpParameters,
    string lpDirectory,
    int nShowCmd);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Possible values for lpOperation

edit

explore

find

open

print

NULL - Performs the default action (prior to Win2k) normally open

Sample Code:

    // Asks default mail client to send an email to the specified address.
    ShellExecute( IntPtr.Zero, "open", "mailto:support@microsoft.com", "", "", 0 );

    // Asks default browser to visit the specified site.
    ShellExecute( IntPtr.Zero, "open", "http://channel9.msdn.com", "", "", 0 );

    // Opens default HTML editing app to allow for edit of specified file
    ShellExecute( IntPtr.Zero, "edit", @"c:\file.html", "", "", 0 );

Alternative Managed API:

Do you know one? Please contribute it!

Documentation