如题
------解决思路----------------------
声明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文件