Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-模块/函数/VBA

ShellExecute

时 间:2008-08-18 22:12:32
作 者:umvsoft整理   ID:43  城市:江阴
摘 要:ShellExecute
正 文:

 

ShellExecute能打开东西很多,打开外部程序、网页、文件夹、EMAIL、我的文档、我的电脑、回收站等等。一切与系统关联的东西都可以用它来打开,谓之“全能打手”也不过份。

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

'lpOperation可用参数:open、print、find、explore、edit

'nShowCmd参数 窗口模式类型声明
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWNOACTIVATE = 4
Private Const SW_SHOW = 5
Private Const SW_MINIMIZE = 6
Private Const SW_SHOWMINNOACTIVE = 7
Private Const SW_SHOWNA = 8
Private Const SW_RESTORE = 9


'激活相关程序,发送EMAIL
ShellExecute Me.hwnd, vbNullString, "mailto:ewang11@21cn.com", vbNullString, "C:\", SW_SHOWNORMAL

'打开应用程序
'打开计算器
ShellExecute Me.hwnd, "open", "calc.exe", "", "", SW_SHOW
'最大化打开记事本
'ShellExecute Me.hwnd, "open", "notepad.exe", "", "", SW_SHOWMAXIMIZED
'打开ACCESS文件
'ShellExecute Me.hwnd, "open", "db34.mdb", "", "CurrentProject.Path", SW_SHOW

'以OPEN的方式打开文件夹
'ShellExecute Me.hwnd, "open", "", "", "D:\Bam", SW_SHOWNORMAL
'以explore的方式打开文件夹
'ShellExecute Me.hwnd, "explore", vbNullString, vbNullString, "D:\Bam", SW_SHOWNORMAL
'以find的方式打开文件夹
ShellExecute Me.hwnd, "find", "", "", "D:\Bam", SW_SHOWNORMAL

'打开我的文档
ShellExecute Me.hwnd, "explore", vbNullString, vbNullString, vbNullString, SW_SHOWNORMAL

'打开我的电脑
ShellExecute Me.hwnd, "open", _
        "explorer", _
        "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", _
        vbNullString, SW_SHOWNORMAL

'打开网上邻居
ShellExecute Me.hwnd, "open", _
        "explorer", _
        "::{208D2C60-3AEA-1069-A2D7-08002B30309D}", _
        vbNullString, SW_SHOWNORMAL

'打开回收站
ShellExecute Me.hwnd, "open", _
        "explorer", _
        "::{645FF040-5081-101B-9F08-00AA002F954E}", _
        vbNullString, SW_SHOWNORMAL

'打开网页
ShellExecute Me.hwnd, "open", "http://www.accessbbs.cn/bbs/index.php", "", "", SW_SHOWMAXIMIZED

'打印文件
ShellExecute Me.hwnd, "print", "5.txt", vbNullString, vbNullString, SW_SHOWNORMAL


Access软件网官方交流QQ群 (群号:54525238)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助