您的位置:首页 > 运维架构 > Shell

VB使用ShellExecute调用其他程序

2008-01-21 15:53 363 查看
2007-12-24 14:06:30





VB使用ShellExecute调用其他程序
ShellExecute APi是功能强大的函数调用接口,它不仅可以调用不带参数的可执行文件,还可以执行带参数的文件,如cmd ping 127.0.0.1,还有可以打开指定的网页和收发邮件的功能.
声明:
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-mailto:huolf@tom.com[/u][/url]","","", SW_SHOW );

打开文件夹

ShellExecute(handle, "open", path_to_folder, NULL, NULL, SW_SHOWNORMAL)

用系统打印机打印文档
ShellExecute(this-
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐