用run函数或调用API打开本地文件:
run方法1:用运行某个EXE文件
string str_filelongname,str_filename
GetFileOpenName("请选择运行的exe文件",str_filelongname,str_filename,"EXE","exe Files (*.exe),*.exe")
Run(str_filelongname)
run方法2:指定用某程序打开某文件。
RUN('"C:\Program Files\Office2007\EXCEL.EXE" "D:\CH桌面\测试.xlsx"')
API方法1:适用于PB10以前版本
//在Global External Functions,定义录入:
Function long ShellExecuteA (ulong hwnd,string lpOperation,string lpFile,string lpParameters,string lpDirectory,long nShowCmd) library "shell32.dll"
//代码调用时写:
string str_filelongname,str_filename
GetFileOpenName("请选择打开的文件",str_filelongname,str_filename,"*","文档(*.*),*.*")
String ls_null
SetNull (ls_null)
ShellExecuteA(Handle(Parent), ls_null, str_filelongname, ls_null,ls_null, 1)
API方法2:用于PB10以后版本
//在Global External Functions,定义录入:
Function long ShellExecuteW (ulong hwnd,string lpOperation,string lpFile,string lpParameters,string lpDirectory,long nShowCmd) library "shell32.dll"
//代码调用时写:
string str_filelongname,str_filename
GetFileOpenName("请选择打开的文件",str_filelongname,str_filename,"*","文档(*.*),*.*")
String ls_null
SetNull (ls_null)
ShellExecuteW(Handle(Parent), ls_null, str_filelongname, ls_null,ls_null, 1)
PB中打开本地文件的四种方法的关键代码.rar
需积分: 50 89 浏览量
2019-12-23
14:36:58
上传
评论
收藏 6KB RAR 举报
weixin_42488022
- 粉丝: 0
- 资源: 4
最新资源
- c语言文件读写操作代码.pdf
- C/C++,图形学-朱莉娅分形集(Julia Fractal)的计算方法与源程序
- 基于paddle+flask实现的猪只识别计数python源码数据集+模型+使用说明(高分项目).zip
- C/C++,树算法-K叉树(k-dimensional-tree)的计算方法与源代码
- msql pre-test
- C/C++,树算法-最小K叉树的计算方法与源程序
- 焊点标注-B07焊点111111111111111111.zip
- C/C++,树算法-K叉树的修剪(删除)算法及其源程序
- QT6实战-QML与C++联合编程教程
- C/C++,图算法-使用K近邻算法查找未知点组的计算方法与源程序
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈