“快退”按钮代码:
int current=flash.CurrentFrame();
if(current>4)
{
current-=5;
flash.GotoFrame(current);
}
else
{
flash.put_FrameNum(0);
}
“快进”按钮代码:
int current=flash.CurrentFrame();
int i=flash.get_FrameNum();
if(current<flash.get_TotalFrames()-5)
{
current+=5;
flash.GotoFrame(current);
}
else
{
flash.put_FrameNum(flash.get_TotalFrames()-1);
}
“放大”按钮代码:
flash.Zoom(50);
“缩小”按钮代码:
flash.Zoom(200);
“还原”按钮代码:
flash.Zoom(0);
“关闭”按钮代码:
flash.put_Movie("http://");
KillTimer(m_nTimer); //停止计时器
CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
m_pSlider->SetPos(0); //滑块置零
timerflag=FALSE;////////////////////////////////
playflag=FALSE;////////////////////////////////
5。添加Slider 控件的消息处理函数PreTranslateMessage()响应的消息NM_RELEASEDCAPTURE
CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
int num=m_pSlider->GetPos();
num=num*flash.get_TotalFrames()/100;
flash.GotoFrame(num);
////////////////////////////////////////////////////////////////////////////////////
将下面代码添加到,Dialog类的OnInitDialog()函数中
CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
m_pSlider->SetRange(0,100); //设定Slider的活动范围是0~100
6。添加Dialog类的OnTimer()函数响应消息WM_TIMER
在OnTimer()函数中添加代码:
CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
m_pSlider->SetPos(flash.CurrentFrame()*100/flash.get_TotalFrames());
7。在Dialog类的DestroyWindow()函数中添加代码:
if(timerflag)
KillTimer(m_nTimer);
8。“全屏”按钮代码:
if(!screenflag && playflag)
{
GetWindowPlacement(&m_WndPos);
flash.GetWindowPlacement(&m_FlashPos);
flash.GetWindowRect(flashrect);
CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
m_pSlider->ShowWindow(SW_HIDE );
HWND hwnd=this->GetSafeHwnd();
LONG style=GetWindowLongPtr(hwnd,GWL_STYLE);
SetWindowLongPtr(hwnd,GWL_STYLE,style-WS_CAPTION );
CClientDC dc(this);
this->MoveWindow(0,0,dc.GetDeviceCaps(HORZRES),dc.GetDeviceCaps(VERTRES));
flash.SetWindowPos(&CWnd::wndTop ,0,0,dc.GetDeviceCaps(HORZRES),dc.GetDeviceCaps(VERTRES),SWP_SHOWWINDOW);
screenflag=TRUE;////////////////////
}
9。响应按键ESC消息,取消全屏。
重载对话框的PreTranslateMessage()函数,在函数中添加如下代码:
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam==VK_ESCAPE)
{
if(screenflag)
{
HWND hwnd=this->GetSafeHwnd();
LONG style=GetWindowLongPtr(hwnd,GWL_STYLE);
SetWindowLongPtr(hwnd,GWL_STYLE,style+WS_CAPTION );
ShowWindow(SW_HIDE);
SetWindowPlacement(&m_WndPos);
flash.MoveWindow(flashrect.left,flashrect.top,flashrect.Width(),flashrect.Height(),1);
flash.SetWindowPlacement(&m_FlashPos);
screenflag=FALSE;
CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
m_pSlider->ShowWindow(SW_SHOW );
}