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
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源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- Access快速开发平台--对上传...(11.22)
- Access快速开发平台企业版--...(11.18)
- 不会用多表联合查询,多表查询没结果...(11.16)
- 【案例分享】主键字段值含有不间断空...(11.16)
- Access快速开发平台--后台D...(11.14)
- 微软Access邀测新Monaco...(11.12)
- Access列表框左右互选、列表框...(11.11)
- 高效率在导入数据前删除记录(11.10)
- Access报价单转订单示例代码(11.08)
- Access系统自带的日期选择器不...(11.08)