- 浏览: 1454301 次
- 性别:
- 来自: 苏州
文章分类
- 全部博客 (564)
- 算法 (7)
- 流金岁月 (1)
- Javascript (30)
- actionscript (108)
- as3.0 game (14)
- flex (84)
- fms2 (27)
- 正则表达式 (7)
- 开源组件代码(as3.0) (1)
- Pv3d (13)
- Cairngorm (4)
- vbs (54)
- VB程序设计 (26)
- 计算机应用与维护 (4)
- 职场实用穿衣技巧 (3)
- 历史风云 (15)
- 淡泊明志,宁静致远 (12)
- 情感 (26)
- 杂谈 (41)
- 越南风 (14)
- DirectX (9)
- Dev-cpp (11)
- 回望百年 (2)
- 建站经验 (2)
- Python (24)
- 网络赚钱 (4)
- php (2)
- html (1)
- ob0短址网 (1)
- ob0.cn (1)
- wordpress (1)
- pandas logistic (1)
- haxe (1)
- opencv (1)
- 微信小程序 (3)
- vue (3)
- Flutter (1)
最新评论
-
GGGGeek:
第一个函数滚动监听不起作用,onPageScroll可以
微信小程序--搜索框滚动到顶部时悬浮 -
naomibyron:
解决办法:工具 -> 编译选项 -> 编译器 ...
dev-c++中编译含WINSOCK的代码出现错误的解决方法 -
haichuan11:
这个…… 代码不全真的是让人很憋屈的感觉啊
actionScript 3.0 图片裁剪及旋转 -
chenyw101:
老兄能留个QQ号吗?具体的我有些东西想请教下你
用VB制作网站登陆器 -
yantao1943:
貌似有点问题,只派发一次事件啊
使用ActionScript 2.0或ActionScript 3.0处理音频文件的提示点(cue
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_folder, NULL, NULL, SW_SHOWNORMAL)
用系统打印机打印文档
ShellExecute(this->m_hWnd,"print","c:abc.txt","","", SW_HIDE);
本函数还可以用来连接到网页,照下面写就行了:
ShellExecute 0&, vbNullString, "", vbNullString, vbNullString, vbNormalFocus
或者这样写来发送Email:
ShellExecute me.hwnd, "open", "mailto:xxf@5y6s.com", vbNullString, vbNullString, SW_SHOW
另外有ShellExecute的替代用法,更加简单实用,不用API,一句Shell搞定!
连接到网页:
Shell "rundll32.exe url.dll,FileProtocolHandler "
打开文件:
Shell "rundll32.exe url.dll,FileProtocolHandler " & App.Path & "SHELLTST.TXT"
ShellExecute API应用整理
作者: yanek
1. 执行“打开”,“查找”,“资源管理器”和“打印”
必要的声明:
’ nShowCmd
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
’ Error Code
Public Const ERROR_FILE_NOT_FOUND = 2
Public Const ERROR_PATH_NOT_FOUND = 3
Public Const ERROR_BAD_FORMAT = 11
Public Const SE_ERR_FNF = 2
Public Const SE_ERR_PNF = 3
Public Const SE_ERR_ACCESSDENIED = 5
Public Const SE_ERR_OOM = 8
Public Const SE_ERR_SHARE = 26
Public Const SE_ERR_ASSOCINCOMPLETE = 27
Public Const SE_ERR_DDETIMEOUT = 28
Public Const SE_ERR_DDEFAIL = 29
Public Const SE_ERR_DDEBUSY = 30
Public Const SE_ERR_NOASSOC = 31
Public Const SE_ERR_DLLNOTFOUND = 32
Public 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
“打开“操作
ShellExecute Me.hwnd, "open", _
Text1.Text, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
“查找“操作
ShellExecute Me.hwnd, "find", _
LocalDir, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
“打印“操作
ShellExecute Me.hwnd, "print", _
Text1.Text, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
“资源管理器“
ShellExecute Me.hwnd, "explore", _
LocalDir, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
打开“我的文档“
ShellExecute Me.hwnd, _
"open", "explorer", _
vbNullString, vbNullString, _
SW_SHOWNORMAL
打开“我的电脑“
’ 我的电脑
’ HKEY_CLASSES_ROOTCLSID’ {20D04FE0-3AEA-1069-A2D8-08002B30309D}
ShellExecute Me.hwnd, "open", _
"explorer", _
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", _
vbNullString, SW_SHOWNORMAL
打开“网上邻居“
’ 网上邻居
’ HKEY_CLASSES_ROOTCLSID’ {208D2C60-3AEA-1069-A2D7-08002B30309D}
ShellExecute Me.hwnd, "open", _
"explorer", _
"::{208D2C60-3AEA-1069-A2D7-08002B30309D}", _
vbNullString, SW_SHOWNORMAL
打开“回收站“
’ 回收站
’ HKEY_CLASSES_ROOTCLSID’ {645FF040-5081-101B-9F08-00AA002F954E}
ShellExecute Me.hwnd, "open", _
"explorer", _
"::{645FF040-5081-101B-9F08-00AA002F954E}", _
vbNullString, SW_SHOWNORMAL
ShellExecuteEx API演示
必要声明:
Public Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
’ Optional fields
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
’ fMask
Public Const SEE_MASK_CLASSKEY = &H3
Public Const SEE_MASK_CLASSNAME = &H1
Public Const SEE_MASK_CONNECTNETDRV = &H80
Public Const SEE_MASK_DOENVSUBST = &H200
Public Const SEE_MASK_FLAG_DDEWAIT = &H100
Public Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SEE_MASK_HOTKEY = &H20
Public Const SEE_MASK_ICON = &H10
Public Const SEE_MASK_IDLIST = &H4
Public Const SEE_MASK_INVOKEIDLIST = &HC
Public Const SEE_MASK_NOCLOSEPROCESS = &H40
Public Declare Function ShellExecuteEX Lib "shell32.dll" _
Alias "ShellExecuteEx" _
(lpExecInfo As SHELLEXECUTEINFO) As Boolean
执行调用“文件属性“对话框
Dim dwReturn As Long
Dim lpExecInfo As SHELLEXECUTEINFO
With lpExecInfo
.cbSize = Len(lpExecInfo)
.fMask = SEE_MASK_NOCLOSEPROCESS or _
SEE_MASK_INVOKEIDLIST or _
SEE_MASK_FLAG_NO_UI
.hwnd = Me.hwnd
.lpVerb = "properties"
.lpFile = LocalDir & File1.FileName
.lpParameters = vbNullChar
.lpDirectory = vbNullChar
.nShow = SW_SHOWNORMAL
.hInstApp = 0
.lpIDList = 0
End With
dwReturn = ShellExecuteEX(lpExecInfo)
声明:
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_folder, NULL, NULL, SW_SHOWNORMAL)
用系统打印机打印文档
ShellExecute(this->m_hWnd,"print","c:abc.txt","","", SW_HIDE);
本函数还可以用来连接到网页,照下面写就行了:
ShellExecute 0&, vbNullString, "", vbNullString, vbNullString, vbNormalFocus
或者这样写来发送Email:
ShellExecute me.hwnd, "open", "mailto:xxf@5y6s.com", vbNullString, vbNullString, SW_SHOW
另外有ShellExecute的替代用法,更加简单实用,不用API,一句Shell搞定!
连接到网页:
Shell "rundll32.exe url.dll,FileProtocolHandler "
打开文件:
Shell "rundll32.exe url.dll,FileProtocolHandler " & App.Path & "SHELLTST.TXT"
ShellExecute API应用整理
作者: yanek
1. 执行“打开”,“查找”,“资源管理器”和“打印”
必要的声明:
’ nShowCmd
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
’ Error Code
Public Const ERROR_FILE_NOT_FOUND = 2
Public Const ERROR_PATH_NOT_FOUND = 3
Public Const ERROR_BAD_FORMAT = 11
Public Const SE_ERR_FNF = 2
Public Const SE_ERR_PNF = 3
Public Const SE_ERR_ACCESSDENIED = 5
Public Const SE_ERR_OOM = 8
Public Const SE_ERR_SHARE = 26
Public Const SE_ERR_ASSOCINCOMPLETE = 27
Public Const SE_ERR_DDETIMEOUT = 28
Public Const SE_ERR_DDEFAIL = 29
Public Const SE_ERR_DDEBUSY = 30
Public Const SE_ERR_NOASSOC = 31
Public Const SE_ERR_DLLNOTFOUND = 32
Public 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
“打开“操作
ShellExecute Me.hwnd, "open", _
Text1.Text, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
“查找“操作
ShellExecute Me.hwnd, "find", _
LocalDir, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
“打印“操作
ShellExecute Me.hwnd, "print", _
Text1.Text, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
“资源管理器“
ShellExecute Me.hwnd, "explore", _
LocalDir, _
vbNullString, vbNullString, _
SW_SHOWNORMAL
打开“我的文档“
ShellExecute Me.hwnd, _
"open", "explorer", _
vbNullString, vbNullString, _
SW_SHOWNORMAL
打开“我的电脑“
’ 我的电脑
’ HKEY_CLASSES_ROOTCLSID’ {20D04FE0-3AEA-1069-A2D8-08002B30309D}
ShellExecute Me.hwnd, "open", _
"explorer", _
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", _
vbNullString, SW_SHOWNORMAL
打开“网上邻居“
’ 网上邻居
’ HKEY_CLASSES_ROOTCLSID’ {208D2C60-3AEA-1069-A2D7-08002B30309D}
ShellExecute Me.hwnd, "open", _
"explorer", _
"::{208D2C60-3AEA-1069-A2D7-08002B30309D}", _
vbNullString, SW_SHOWNORMAL
打开“回收站“
’ 回收站
’ HKEY_CLASSES_ROOTCLSID’ {645FF040-5081-101B-9F08-00AA002F954E}
ShellExecute Me.hwnd, "open", _
"explorer", _
"::{645FF040-5081-101B-9F08-00AA002F954E}", _
vbNullString, SW_SHOWNORMAL
ShellExecuteEx API演示
必要声明:
Public Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
’ Optional fields
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
’ fMask
Public Const SEE_MASK_CLASSKEY = &H3
Public Const SEE_MASK_CLASSNAME = &H1
Public Const SEE_MASK_CONNECTNETDRV = &H80
Public Const SEE_MASK_DOENVSUBST = &H200
Public Const SEE_MASK_FLAG_DDEWAIT = &H100
Public Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SEE_MASK_HOTKEY = &H20
Public Const SEE_MASK_ICON = &H10
Public Const SEE_MASK_IDLIST = &H4
Public Const SEE_MASK_INVOKEIDLIST = &HC
Public Const SEE_MASK_NOCLOSEPROCESS = &H40
Public Declare Function ShellExecuteEX Lib "shell32.dll" _
Alias "ShellExecuteEx" _
(lpExecInfo As SHELLEXECUTEINFO) As Boolean
执行调用“文件属性“对话框
Dim dwReturn As Long
Dim lpExecInfo As SHELLEXECUTEINFO
With lpExecInfo
.cbSize = Len(lpExecInfo)
.fMask = SEE_MASK_NOCLOSEPROCESS or _
SEE_MASK_INVOKEIDLIST or _
SEE_MASK_FLAG_NO_UI
.hwnd = Me.hwnd
.lpVerb = "properties"
.lpFile = LocalDir & File1.FileName
.lpParameters = vbNullChar
.lpDirectory = vbNullChar
.nShow = SW_SHOWNORMAL
.hInstApp = 0
.lpIDList = 0
End With
dwReturn = ShellExecuteEX(lpExecInfo)
发表评论
-
wxpython学习笔记
2011-01-13 21:21 2031出处:http://www.cnblogs.com ... -
ADO编程实用宝典
2009-05-08 13:05 1477目录 ADO编程实用宝典 目录 一引入A ... -
创建ACCESS的存储过程
2008-09-11 22:52 4802在Access自身的帮助中看到了Create Procedu ... -
实现服务器端的多线程SOCKET Server
2008-09-11 16:45 3412实现服务器端的多线程SOCKET Server 想要实现 ... -
轻量级xml读写模块 tinyXML
2008-09-11 16:32 2900文档和使用例子: http://www.grinningl ... -
基于TinyXML的XML文档操作(部分测试代码)
2008-09-11 16:31 2436#include <stdio.h> #incl ... -
使用tinyxml类解析XML
2008-09-11 16:26 2450读取和设置xml配置文件是最常用的操作,试用了几个C++的XM ... -
用VB制作网站登陆器
2008-08-25 20:59 4098Private Sub Command1_Click() Wb ... -
vb+Webbrowser控件详解
2008-08-25 20:54 3283方法 说明 GoBack 相当 ... -
VB自动提交表单问题
2008-08-25 14:32 2478需要知道表单名称呢,比如 <Form name=&quo ... -
BBS灌水机脚本(vb scritp, telnet, bbs, sterm)
2008-08-16 11:32 2517'****************************** ... -
c++下载网页的代码,VC6.0编译通过
2008-05-30 19:21 3858#include <winsock2.h> ... -
【译】C/S 多线程Socket类
2008-05-30 19:16 1676Multi-threaded Client/Server So ... -
C++ Socket Class for Windows
2008-05-30 18:59 1633Here, I present the source c ... -
C++ socket程序
2008-05-30 17:58 11513C++ socket程序 下面是一个C++调用windows ... -
字符串提取
2008-05-05 11:24 1303Function bTest(ByVal s As Strin ... -
VB用正则表达式提取网页中的链接
2008-05-05 10:37 2904VBScript code Function getUrl ... -
利用VB提取HTML文件中的EMAIL地址
2008-05-05 09:53 1193电子邮件(EMAIL)是INTERNET上应用最广泛的一种服务 ... -
VB6.0如何使用正则表达式
2008-05-04 20:39 8012最近在用VB6解决一个网页解析的应用,涉及到了正则。如何在VB ... -
VB写一个IE插件
2008-05-04 18:20 3072Q: 就类似于3721的插件一样,当用户浏览我的网站的时候,提 ...
相关推荐
在这个主题中,我们关注的是如何使用`ShellExecute`函数来实现这一功能。`ShellExecute`是Windows API提供的一种功能强大的函数,它允许应用程序执行各种操作,包括打开文件、打印文档、发送邮件等,而且可以处理以...
本主题将深入探讨如何使用VB API函数来调用计算器应用,这在需要进行简单计算或者集成计算器功能到自定义应用程序时非常有用。 首先,我们需要了解API函数的基本概念。API是一组预定义的函数、常量、数据类型等,...
在提供的代码示例中,展示了如何使用ShellExecute函数来执行不同的任务。以下是对代码示例的详细知识点解析: 1. ShellExecute函数的基本语法: ```cpp HINSTANCE ShellExecute( HWND hwnd, // Handle to a parent...
' 调用ShellExecute函数,打开“浏览文件”对话框 If ShellExecute(Me.hWnd, "open", "explorer.exe", "/select," & path, "", SW_SHOWNORMAL) MsgBox "打开文件对话框失败!" Else ' 如果用户选择了文件,...
了解并熟练使用API函数可以极大地扩展VB的编程能力,使你的程序能够执行更底层的操作。在实际编程中,务必注意正确地声明和使用API函数,因为它们涉及到系统的底层操作,错误的使用可能导致程序崩溃或不稳定。同时,...
2. **弹出光驱**:可以使用`SendKeys`函数模拟用户按下光驱的弹出键,或者使用`ShellExecute` API来执行打开/关闭光驱的操作。 3. **判断驱动器属性**:利用`GetDriveType` API可以判断一个驱动器是硬盘、光驱、...
标题"vb 中api函数 特殊文件夹的调用"主要涉及到的是如何使用API函数来访问和操作Windows中的特殊文件夹,如桌面、我的文档、程序文件夹等。这些文件夹在Windows中具有特定的标识符,通过API函数可以方便地进行读取...
#### 方法二:使用ShellExecute函数 **基本原理** `ShellExecute`函数是一个更强大的API函数,它提供了更多的控制选项,比如可以指定窗口显示的方式等。 **代码示例** ```vb Private Declare Function ...
这个过程涉及到Windows API(应用程序接口)的使用,特别是使用`ShellExecute`函数来启动外部应用程序。下面我们将深入探讨如何在VB6.0中实现这一功能,以及涉及的相关知识点。 首先,我们需要了解VB6.0的基本编程...
在VB6(Visual Basic 6)中,要获取并显示文件的默认图标,我们需要使用Windows API函数来实现这一功能。API函数提供了与操作系统更底层的交互...这涉及到对Windows API的深入理解和使用,是VB6编程中的一个重要技巧。
1. ShellExecute.exe:这可能是一个已经编译并可执行的VB程序,实现了外壳程序接口的功能,比如使用ShellExecute函数来启动其他应用程序或者打开文件。 2. frmMain.frm:这是VB中的一个表单文件,通常包含了用户...
在VB(Visual Basic)编程中,API(Application Programming Interface)函数是开发者经常使用的工具,以扩展VB的基础功能,实现更复杂或系统级别的操作。这些API函数通常基于Win32 API,一个广泛应用于Windows操作...
在VB(Visual Basic)编程中,操作注册表是一项常见的任务,它允许开发者读取、写入、修改或删除系统中的注册表键值,从而影响软件的行为或者存储应用程序配置信息。注册表是Windows操作系统中存储系统和应用程序...
在VB6.0中,由于内置的控件可能无法满足所有需求,开发者会使用API调用来扩展其功能。 在VB6.0中调用API函数需要以下步骤: 1. **导入API函数**:首先,你需要导入相应的API函数。在VB6中,这通常通过`Declare`...
3. **ShellExecute函数**:这是一个API函数,可以用来执行各种操作,包括关闭系统。调用`ShellExecute`函数,传入适当的参数(如"shutdown"命令),可以在倒计时结束后执行关机操作。 4. **对话框设计**:为了获取...
这不仅涉及到VB编程语言的使用,还包括了Windows操作系统中DLL(动态链接库)的调用机制,以及如何利用系统的Shell功能来启动特定的应用程序或服务。 ### VB编程与系统资源调用 Visual Basic是一种广泛使用的事件...
这个功能通过调用Windows API(应用程序接口)中的`ShellExecute`函数实现,使得开发者能够方便地在VB程序中集成各种系统操作。 【Run Shell VB】是指使用VB中的Shell函数来运行命令或者程序。这个函数允许程序员...
在VB6中,如果需要关闭其他正在运行的程序,可以使用操作系统API函数,比如ShellExecute或CreateProcess,然后配合适当的参数来结束指定进程。这通常涉及到更复杂的编程技巧,需要了解Windows API以及如何在VB6中...
1. 开机启动:通过VB API调用`ShellExecute`或者`RegCreateKeyEx`、`RegSetValueEx`等函数,可以在注册表中设置启动项,使得应用程序能够在用户登录或系统启动时自动运行。 2. DLL注入:DLL注入是一种技术,用于将...
2. **声明API函数**:在VB中使用API函数前,需要先声明相应的函数原型,例如: ```vb Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hwnd As Long, ByVal ...