首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

用PB打开指定目录下的PPT文件解决方法

2012-03-15 
用PB打开指定目录下的PPT文件如题[解决办法]声明ShellExecuteAFUNCTIONulongShellExecuteA(ulonghwnd,refs

用PB打开指定目录下的PPT文件
如题

[解决办法]
声明ShellExecuteA

FUNCTION ulong ShellExecuteA(ulong hwnd,ref string lpOperation,ref string lpFile,ref string lpParameters,ref string lpDirectory,ulong nShowCmd) LIBRARY "SHELL32.dll" ALIAS FOR "ShellExecuteA;Ansi" 

---------

打开PPT按钮代码写:

string ls_path,ls_null 
ls_path = 'D:\企業管理與5S管理.ppt'
setnull( ls_null ) 
shellexecuteA( handle(parent), ls_null, ls_path, ls_null, ls_null, 1 )

----
试验了 可行

[解决办法]
OLEobject ole_export
ole_export = CREATE OLEObject
long li_Return
string ls_xlsreport
ls_xlsreport = 'D:\企業管理與5S管理.ppt'

ll_find = iuo_file.FindWindowA(0, "microsoft powerpoint - " + ls_xlsreport)
if ll_find > 0 then
li_Return = ole_export.ConnectToObject(ls_xlsreport)
if li_Return = 0 then
ole_export.Application.DisplayAlerts = False
ole_export.application.quit()
ole_export.DisConnectObject()
end if
end if

//连结PowerPoint
li_Return = ole_export.ConnectToNewObject("powerpoint.application")
If li_Return <> 0 then
DESTROY ole_export
MessageBox("启动 PowerPoint","不能连结 Microsoft PowerPoint !")
return
end if

//PowerPoint显示
ole_export.Visible = true
ole_export.WindowState = 1

//开启PowerPoint档案
ole_export.documents.open(ls_xlsreport)//修改成下面语句
ole_export.Presentations.Open(ls_xlsreport)

上述代码的改动版,已经通过测试,可以打开指定的ppt文件




热点排行
Bad Request.