全能打手,首推ShellExecute
时 间:2008-12-22 10:20:47
作 者:andymark ID:1350 城市:深圳
摘 要:全能打手,首推ShellExecute
正 文:
全能打手,首推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.08)
- 分享一下Access工程中的acw...(11.07)
- Access快速开发平台--让有权...(11.04)
- Access快速开发平台--审批选...(11.01)
- ACCESS两张表先各自排序,然后...(10.31)
- Access对子窗体数据进行批量+...(10.30)
- SqlServer中如何用SQL命...(10.29)
- Access报表中的分组功能用代码...(10.28)
- 用Access计算库存结余的一个方...(10.26)
- 最精简的组合框行来源数据快速输入(...(10.25)