ShellExecute
声明:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hWnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
原型:
HINSTANCE ShellExecute(
HWND hwnd, //父窗口句柄
LPCTSTR lpOperation, //操作,"open","print","explore"
LPCTSTR lpFile, //文件名,前面可加路径
LPCTSTR lpParameters, //参数
LPCTSTR lpDirectory, //默认文件夹
INT nShowCmd //显示方式
);
打开一个应用程序
ShellExecute(this->m_hWnd,"open","calc.exe","","", SW_SHOW );
或
ShellExecute(this->m_hWnd,"open","notepad.exe","c:MyLog.log","",SW_SHOW );
打开一个同系统程序相关连的文档
ShellExecute(this->m_hWnd,"open","c:abc.txt","","",SW_SHOW );
激活相关程序,发送EMAIL
ShellExecute(this->m_hWnd,"open","mailto:xxf@5y6s.com","","", SW_SHOW );
打开文件夹
ShellExecute(handle, "open", path_to_f
声明:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hWnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
原型:
HINSTANCE ShellExecute(
HWND hwnd, //父窗口句柄
LPCTSTR lpOperation, //操作,"open","print","explore"
LPCTSTR lpFile, //文件名,前面可加路径
LPCTSTR lpParameters, //参数
LPCTSTR lpDirectory, //默认文件夹
INT nShowCmd //显示方式
);
打开一个应用程序
ShellExecute(this->m_hWnd,"open","calc.exe","","", SW_SHOW );
或
ShellExecute(this->m_hWnd,"open","notepad.exe","c:MyLog.log","",SW_SHOW );
打开一个同系统程序相关连的文档
ShellExecute(this->m_hWnd,"open","c:abc.txt","","",SW_SHOW );
激活相关程序,发送EMAIL
ShellExecute(this->m_hWnd,"open","mailto:xxf@5y6s.com","","", SW_SHOW );
打开文件夹
ShellExecute(handle, "open", path_to_f
VB ShellExecute函数应用技巧与示例

本文介绍了VB中的ShellExecute函数,用于执行各种操作,如打开应用程序、打印文档、浏览文件夹等。通过示例代码展示了如何使用ShellExecute打开计算器、记事本、电子邮件、文件夹等,并提到了其替代方法以及错误处理代码。
最低0.47元/天 解锁文章
3250

被折叠的 条评论
为什么被折叠?



