怎样实现mfc操作ppt文件的打开、播放、关闭等,网络上基本上有了详细的实现方式,比如如下博主们的简介:
转:http://blog.sina.com.cn/s/blog_6163bdeb0100nn1p.html
转:http://www.2cto.com/kf/201505/396898.html
转:http://blog.sina.com.cn/s/blog_4e345ce70100j4m1.html
上述文章都很详细的介绍了mfc通过com接口实现ppt相关操作的实现步骤,我自己也进行了代码实现,请参考:http://download.csdn.net/detail/leighton_52/9277441
但是,实现的过程中我发现了一个问题,那就是上述实现只能对后缀名为.ppt的文件操作,而不可以对.pptx进行操作,随着windows office的不断升级,怎么解决这个问题呢,也变得比较重要了。
我作为技术菜鸟,很抱歉,也无法为你解答,不过如果你只是简单的对文件实施打开,翻页以及关闭的话,我倒是可以提供一个更为简单的实现方法,仅供参考。
打开ppt 文件:CString sPPTPath;
ShellExecute(NULL,"open",sPPTPath,NULL,NULL,SW_SHOW);
播放ppt 文件:
keybd_event(0x74,0,0,0); //74,键盘F5对应的ascii值
keybd_event(0x74,0,KEYEVENTF_KEYUP,0);
翻页:
keybd_event(38,0,0,0); (上一页)
keybd_event(38,0,KEYEVENTF_KEYUP,0);
keybd_event(40,0,0,0); (下一页)
keybd_event(40,0,KEYEVENTF_KEYUP,0);
结束:
if (CCommonFun::IsRunProcess(_T("POWERPNT.EXE")))
{
CCommonFun::TerminateProcessEx(_T("POWERPNT.EXE"));
}
实现原理,是通过系统函数打开ppt文件,然后通过代码控制键盘,对文件进行操作