windows API 函数 ShellExecute 的多种用法
来源:互联网 发布:linux find 大小写 编辑:程序博客网 时间:2024/04/30 13:02
在一个网站看资料时,发现一个关于WINDOWS API函数的学习资料,翻译下来认初学者更快的了解这个API的使用。
ShellExecute的功能是运行一个外部程序(或者是打开一个已注册的文件、打开一个目录、打印一个文件等等),并对外部程序有一定的控制。
有几个API函数都可以实现这些功能,但是在大多数情况下ShellExecute是更多的被使用的,同时它并不是太复杂。下面举例说明它的用法。
- 开始一个新的应用程序
ShellExecute(Handle, 'open', PChar('c:/test/app.exe'), nil, nil, SW_SHOW);
- 打开记事本,并打开一个文件(系统能识别记事本应用程序的路径,因此我们不必使用绝对路径)
ShellExecute(Handle, 'open', PChar('notepad'), PChar('c:/test/readme.txt'), nil, SW_SHOW);
- 打印一个文档
ShellExecute(Handle, 'print', PChar('c:/test/test.doc'), nil, nil, SW_SHOW);
注意:可能你会看到word暂时的被打开,但它会自动关闭。
- 打开一个HTML页面
ShellExecute(Handle, 'open', PChar('http://www.festra.com/'), nil, nil, SW_SHOW);
- 你能通过一个已经注册的文件类型来打开应用程序
ShellExecute(Handle, 'open', PChar('c:/test/readme.txt'), nil, nil, SW_SHOW);
- 用windows Explorer 打开一个目录
ShellExecute(Handle, 'explore', PChar('c:/windows)', nil, nil, SW_SHOW);
- 运行一个DOS命令并立即返回
ShellExecute(Handle, 'open', PChar('command.com'), PChar('/c copy file1.txt file2.txt'), nil, SW_SHOW);
- 运行一个DOS命令并保持DOS窗口存在
ShellExecute(Handle, 'open', PChar('command.com'), PChar('/k dir'), nil, SW_SHOW);
- windows API 函数 ShellExecute 的多种用法
- windows API 函数 ShellExecute 的多种用法
- windows API 函数 ShellExecute 的多种用法
- windows API 函数 ShellExecute 的多种用法
- windows API 函数 ShellExecute 的多种用法
- ShellExecute函数的用法
- VC中API函数 ShellExecute用法
- API函数ShellExecute与ShellExecuteEx用法
- ShellExecute API函数用法简析
- API函数ShellExecute与ShellExecuteEx用法
- ShellExecute函数的用法总结
- 介绍一个功能强大的API函数 ShellExecute
- 介绍一个功能强大的API函数 ShellExecute
- 介绍一个功能强大的API函数 ShellExecute
- c++API函数ShellExecute的使用
- 介绍一个功能强大的API函数 ShellExecute
- Api ShellExecute 函数
- c++ builder 中ShellExecute函数的用法
- DataReader也玩超酷数据显示分页
- 常见 Datagrid 错误
- ASP.NET下MVC设计模式的实现
- 简易计算器
- 计算机科学与技术学生学习基础材料参考
- windows API 函数 ShellExecute 的多种用法
- 3层架构浅晰
- ★引子★:保留的含义㈠
- DOS下的保留
- 支持拨号网络脚本制作的拨号脚本制作命令语言
- .NET 动态加载程序集 (一)
- 动态加栽程序集(二)
- 动态加载程序集(三)
- 向datagrid中加横向 纵向的合计 (在datatable中实现,datatable间倒数据)