本文例子基于VS2005创建,编译通过。
打开VS2005创建一个基于对话框的MFC应用程序,完成创建。
![](http://hi.csdn.net/attachment/201104/15/0_130283273453wE.gif)
打开资源视图,删除默认控件。
![](http://hi.csdn.net/attachment/201104/15/0_1302832837IlrF.gif)
右键点击对话框,选择插入Active控件,在弹出的对话框选择shockwave Flash Object, 确定。
![](http://hi.csdn.net/attachment/201104/15/0_1302833012nFLZ.gif)
![](http://hi.csdn.net/attachment/201104/15/0_13028330618Z47.gif)
出现黑色框体(flash 播放框体),拖动黑色框体至窗口大小,右键点击,添加成员变量m_flashShow,完成。
![](http://hi.csdn.net/attachment/201104/15/0_1302833187emEM.gif)
打开类视图,在XXDlg对话框类OnInitDialog函数中添加如下代码:
-
- RECT rc;
-
- this->GetClientRect(&rc);
-
- m_flashShow.MoveWindow(&rc, true);
- TCHAR curPath[500];
-
- int nLength = ::GetCurrentDirectory(500, curPath);
- if (curPath[nLength]!='//')
- {
- curPath[nLength++]='//';
- curPath[nLength]='/0';
- }
-
- CString fileName = curPath;
-
- fileName+="start.swf";
-
- m_flashShow.LoadMovie(0, fileName);
-
- m_flashShow.Play();
![](http://hi.csdn.net/attachment/201104/15/0_13028332697LXY.gif)
拷贝flash文件到目录下
![](http://hi.csdn.net/attachment/201104/15/0_1302833386A0AI.gif)
至此完工
![](http://hi.csdn.net/attachment/201104/15/0_1302833494jZZL.gif)