用VC 6.0写flash播放器——3、使用定时器
来源:互联网 发布:茂日软件怎么样 编辑:程序博客网 时间:2024/05/16 04:08
purpleendurer 原创
2005.11.15 第1版
我们已经为作为主窗口的对话框加入了状态栏。为了在状态栏的第二部分动态地显示当前播放的是第几帧,我们使用了定时器。
实现方法如下:
1。在CSwfPlayerDlg类定义中 加入定时器变量的声明,使用定时器的方法以及停止定时器的方法:
class CSwfPlayerDlg : public CDialog
{
....
protected:
HICON m_hIcon;
HWND m_hStatusWindow;
UINT m_Timer1; //定时器变量的声明
.....
private:
void UseTimer1(); //使用定时器
void StopTimer1(); //停止定时器
};
2。UseTimer1()的代码为:
void CSwfPlayerDlg::UseTimer1()//使用定时器
{
if (!m_Timer1)
{
SetTimer(m_Timer1, 500, NULL);
}
}
3。StopTimer1()的代码为:
void CSwfPlayerDlg::StopTimer1()//如果定时器已经启用,则停止它
{
if (m_Timer1)
{
KillTimer(m_Timer1);
m_Timer1 = 0;
}
}
4。在CSwfPlayerDlg的OnInitDialog()加初始化定时变量为0,表示未使用:
BOOL CSwfPlayerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
..........
m_Timer1 = 0; //初始化定时器为未用
return TRUE; // return TRUE unless you set the focus to a control
}
5。对定时器消息WM_TIMER的处理
void CSwfPlayerDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnTimer(nIDEvent);
char buf[50];
char fmt2[] = {"当前为第%d帧"};
wsprintf(buf, fmt2, m_SwfBox.CurrentFrame());
::SendMessage(m_hStatusWindow, SB_SETTEXT, 1, (LPARAM)&buf);
}
这样在我们需要使用定时器时就调用UseTimer1(),要停止定时器时就调用StopTimer1()。
- 用VC 6.0写flash播放器——3、使用定时器
- 用VC 6.0写flash播放器——5、全屏播放
- 用VC 6.0写flash播放器——4、处理窗口缩放
- 用VC 6.0写flash播放器——1、在VC 6.0中调用打开文件对话框
- 用VC 6.0写flash播放器——2、为作为主窗口的对话框添加状态栏
- VC制作简易flash播放器
- VC制作简易flash播放器
- vc 开发简单的flash 播放器
- vc 开发简单的flash 播放器
- VC++播放Flash
- Qt4学习(3)——用定时器循环播放图片
- vc中用WaveOut写音乐播放器
- vc中用WaveOut写音乐播放器
- 一个VC写的音乐播放器
- 千锤百炼VC++实例(连载12) flash播放器的制作
- 使用免费的flash播放器哈哈
- 页面中使用flash播放器
- VC++ 定时器使用
- 彻底的被CSDN的blog系统给打败了,换地方!
- 我的BLOG终于开张了。。。
- sql exceise
- 看颜色表。。我的调色板
- Fedora codes 4 最简单安装指南
- 用VC 6.0写flash播放器——3、使用定时器
- [转]Linux 下串口编程入门
- rootkit入门(翻译)
- [转贴/收藏] 七十年代人的集体画像
- somewhere, something.
- 在 JScript 中释放内存、批量加载问题及其他
- javascript: IE DOM 到 Firefox (W3C) Dom中的问题
- 用Total Commander代替资源管理器
- jbuilder下无法调试Tomcat的WebApp的问题