问题描述
- 程序编译出错 missing ';' before identifier 'm_ActiveMovie'
-
错误:
c:usersadministrator.win-42esb6vovundesktoplilymplilympdlg.h(40) : error C2146: syntax error : missing ';' before identifier 'm_ActiveMovie'
c:usersadministrator.win-42esb6vovundesktoplilymplilympdlg.h(40) : error C2501: 'CWMPPlayer4' : missing storage-class or type specifiers
c:usersadministrator.win-42esb6vovundesktoplilymplilympdlg.h(40) : error C2501: 'm_ActiveMovie' : missing storage-class or type specifiers
C:UsersAdministrator.WIN-42ESB6VOVUNDesktopLilyMPLilyMPDlg.cpp(7) : fatal error C1083: Cannot open include file: 'activemovie3.h': No such file or directory代码:
// LilyMPDlg.cpp : implementation file
//
#pragma once
#include "stdafx.h"
#include "LilyMP.h"
#include "LilyMPDlg.h"
#include "activemovie3.h"#ifdef DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE_;
#endif/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog
{
public:
CAboutDlg();// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA// ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CLilyMPDlg dialogCLilyMPDlg::CLilyMPDlg(CWnd* pParent /*=NULL*/)
: CDialog(CLilyMPDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CLilyMPDlg)
m_pathname = _T("");
m_player = 0;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void CLilyMPDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLilyMPDlg)
DDX_Control(pDX, IDC_BUTTON9, m_delvol);
DDX_Control(pDX, IDC_LIST2, m_list);
DDX_Control(pDX, IDC_BUTTON8, m_addvol);
DDX_Control(pDX, IDC_BUTTON6, m_next);
DDX_Control(pDX, IDC_BUTTON5, m_circle);
DDX_Control(pDX, IDC_BUTTON4, m_pause);
DDX_Control(pDX, IDC_BUTTON3, m_upper);
DDX_Control(pDX, IDC_BUTTON2, m_play);
DDX_Control(pDX, IDC_BUTTON10, m_mute);
DDX_Control(pDX, IDC_BUTTON1, m_open);
DDX_LBString(pDX, IDC_LIST2, m_pathname);
DDX_Slider(pDX, IDC_SLIDER1, m_player);
DDX_Control(pDX, IDC_OCX6, m_ActiveMovie);
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CLilyMPDlg, CDialog)
//{{AFX_MSG_MAP(CLilyMPDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnOpen)
ON_BN_CLICKED(IDC_BUTTON2, OnPlay)
ON_BN_CLICKED(IDC_BUTTON3, OnUpper)
ON_BN_CLICKED(IDC_BUTTON4, OnPause)
ON_BN_CLICKED(IDC_BUTTON6, OnNext)
ON_BN_CLICKED(IDC_BUTTON5, OnCircle)
ON_BN_CLICKED(IDC_BUTTON8, OnAddvol)
ON_BN_CLICKED(IDC_BUTTON9, OnDelvol)
ON_BN_CLICKED(IDC_BUTTON10, OnMute)
ON_NOTIFY(NM_OUTOFMEMORY, IDC_SLIDER1, OnOutofmemorySlider1)
ON_LBN_SELCHANGE(IDC_LIST2, OnSelchangeList2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CLilyMPDlg message handlersBOOL CLilyMPDlg::OnInitDialog()
{
CDialog::OnInitDialog();// Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here /*this->m_pause.EnableWindow(FALSE); this->m_play.EnableWindow(FALSE); this->m_next.EnableWindow(FALSE); this->m_circle.EnableWindow(FALSE);*/ return TRUE; // return TRUE unless you set the focus to a control
}
void CLilyMPDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.void CLilyMPDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); }
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CLilyMPDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}void CLilyMPDlg::OnOpen() //添加文件到列表
{
char szFileFilter[]=
"所有文件(*.*)|*.*|" //可选择所有格式的媒体文件
"avi FILE(*.avi)|*.avi|"
"mp3 FILE(*.mp3)|*.mp3|"
"mpeg FILE(*.mpeg)|*.mpeg|"
"mpga FILE(*.mpga)|*.mpga|"
"wave FILE(*.wav)|*.wav|"
"movie FILE(*.mov)|*.mov|"
"mid FILE(*.mid;*.rmi)|*.mid;*.rmi|"
"wma FILE(*.wma)|*.wma|"
"media FILE(*.asf)|*.asf|";
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY,szFileFilter);
POSITION pos=dlg.GetStartPosition();
if(dlg.DoModal()==IDOK) //消息响应
{while(pos!=NULL)
{m_pathname=dlg.GetNextPathName(pos);
m_list.AddString(m_pathname);} //将选中的文件加入到播放列表中
}}
void CLilyMPDlg::OnPlay() //播放媒体文件
{ CString str;
if(m_list.GetCount()<=0)MessageBox("请先打开最少一个媒体文件!","Warning",MB_OK);
else
{if(m_list.GetCurSel()<0){m_list.SetCurSel(0);}
int index=m_list.GetCurSel();
m_list.GetText(index,str);//获取当前选中文件信息
m_ActiveMovie.Run();//播放当前选中文件
SetTimer(0,50,0);
}}
void CLilyMPDlg::OnCircle()
{
int i;
for(i=0;i<50;i++)
OnNext();}
void CLilyMPDlg::OnUpper()//上一曲
{CString str;
int index=m_list.GetCurSel();
if (index==0)index=m_list.GetCount();
m_list.GetText(index-1,str);
m_ActiveMovie.SetUrl(str);
m_list.SetCurSel(index-1);
}void CLilyMPDlg::OnPause() //暂停/继续
{CString strtemp;
if((m_player.GetPlayState()==2)|| (m_player.GetPlayState()==3))
{
GetDlgItemText(IDC_BUTTON4,strtemp);//获取按钮上的字符
if(strtemp.Compare("暂停")==0)//若显示“暂停”,点击暂停,并显示 “继续”
{m_ActiveMovie.Pause();
SetDlgItemText(IDC_BUTTON4,"继续");}
if(strtemp.Compare("继续")==0)//实现从暂停点继续播放,并显示 “暂停”
{m_ActiveMovie.Run();
SetDlgItemText(IDC_BUTTON4,"暂停");}}
else;
}void CLilyMPDlg::OnNext() //下一曲
{CString str;
int index=m_List.GetCurSel();
if (index==m_List.GetCount()-1)index=-1;m_List.GetText(index+1,str);
m_ActiveMovie.SetUrl(str);
m_list.SetCurSel(index+1);}
void CLilyMPDlg::OnAddvol() //增大音量
{long Volume=m_ActiveMovie.Getvolme();
m_ActiveMovie.Pause;
m_ActiveMovie.SetVolume(Volume+5);
m_ActiveMovie.Run;
}
void CLilyMPDlg::OnDelvol() //减小音量
{long Volume=m_ActiveMovie.Getvolme();
m_ActiveMovie.Pause;
m_ActiveMovie.SetVolume(Volume-5);
m_ActiveMovie.Run;}
void CLilyMPDlg::OnMute() //静音
{
m_ActiveMovie.Pause;
m_ActiveMovie.SetVolume(0);
m_ActiveMovie.Run;
}void CLilyMPDlg::OnSelchangeList2()
{
// TODO: Add your control notification handler code here}
BEGIN_EVENTSINK_MAP(CLilyMPDlg, CDialog)
//{{AFX_EVENTSINK_MAP(CLilyMPDlg)
ON_EVENT(CLilyMPDlg, IDC_OCX6, 5001 /* OpenStateChange */, OnOpenStateChangeOcx6, VTS_I4)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()void CLilyMPDlg::OnOpenStateChangeOcx6(long NewState)
{
// TODO: Add your control notification handler code here}