取扩展名对于的应用程序列表
我想实现右键-》打开方式-》可用应用程序列表。有成型的代码吗谢谢了 --------------------编程问答-------------------- --------------------编程问答-------------------- public enum ShowCommands : int{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZED = 2,
SW_SHOWMAXIMIZED = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVATE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACTIVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZE = 11,
SW_MAX = 11
}
[DllImport("shell32.dll ")]
static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
ShowCommands nShowCmd);
private void OpenStyle_Click(object sender, EventArgs e)
{
ShellExecute(IntPtr.Zero, "open", "rundll32.exe", " shell32.dll OpenAs_RunDLL *.ext", null, ShowCommands.SW_NORMAL);
}
private void Form3_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
OpenStyle = new ToolStripMenuItem();
this.ContextMenuStrip = contextMenuStrip1;
}
} --------------------编程问答--------------------
public enum ShowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZED = 2,
SW_SHOWMAXIMIZED = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVATE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACTIVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZE = 11,
SW_MAX = 11
}
[DllImport("shell32.dll ")]
static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
ShowCommands nShowCmd);
private void OpenStyle_Click(object sender, EventArgs e)
{
ShellExecute(IntPtr.Zero, "open", "rundll32.exe", " shell32.dll OpenAs_RunDLL *.ext", null, ShowCommands.SW_NORMAL);
}
private void Form3_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
this.ContextMenuStrip = contextMenuStrip1;
}
}
contextMenuStrip1是一个包含了OpenStyle(打开方式)的ContextMenuStrip
补充:.NET技术 , C#