MyException - 我的异常网
当前位置:我的异常网» C# » 在C#中调用ShellExecute解决方法

在C#中调用ShellExecute解决方法

www.MyException.Cn  网友分享于:2013-12-29  浏览:65次
在C#中调用ShellExecute
哪位在C#中调用过windows   API函数ShellExecute,
请指教一下具体应该怎样声明,怎样调用?

------解决方案--------------------
www.pinvoke.net

C# Signature:
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);


VB Signature:
Declare Function ShellExecuteA Lib "shell32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Integer) As IntPtr


User-Defined Types:
None.

例子见:
http://www.pinvoke.net/default.aspx/shell32/ShellExecute.html

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有