VS2008下的问题
1、就这么个播放MP3的类,在vc60下是好的,2008下面编译出现很多错误,请高手指点?
2、顺便问下,为什么现在大多数vc开发的例子还是用6.0啊?网上的许多例程在2008里都运行不了。
头文件
// Mp3Player.h: interface for the CMp3Player class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MP3PLAYER_H__1C4FA32F_A422_4681_BE53_09046BE76207__INCLUDED_)
#define AFX_MP3PLAYER_H__1C4FA32F_A422_4681_BE53_09046BE76207__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMp3Player
{
public:
bool Stop();
bool Pause();
bool Play(CString& strPath);
CMp3Player();
virtual ~CMp3Player();
private:
HWND m_hVideo;
bool m_bPause;
};
#endif // !defined(AFX_MP3PLAYER_H__1C4FA32F_A422_4681_BE53_09046BE76207__INCLUDED_)
CPP文件
// Mp3Player.cpp: implementation of the CMp3Player class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Mp3Player.h"
#include "vfw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMp3Player::CMp3Player()
{
m_hVideo = NULL;
}
CMp3Player::~CMp3Player()
{
if(m_hVideo !=NULL)
{
MCIWndDestroy(m_hVideo);
}
}
BOOL CMp3Player::Play(CString &strPath)
{
m_hVideo = NULL;
if(m_hVideo == NULL)
{
m_hVideo = MCIWndCreate(AfxGetMainWnd()->GetSafeHwnd(),
AfxGetInstanceHandle(),
WS_CHILD |MCIWNDF_NOMENU,strPath);
}
else
{
MCIWndHome(m_hVideo);
}
MCIWndPlay(m_hVideo);
m_bPause = FALSE;
return TRUE;
}
BOOL CMp3Player::Pause()
{
if(m_bPause)
{
//m_Pause.SetWindowText("Pause");
MCIWndResume(m_hVideo);
m_bPause = FALSE;
}
else
{
//m_Pause.SetWindowText("UnPause");
MCIWndPause(m_hVideo);
m_bPause = TRUE;
}
return m_bPause;
}
BOOL CMp3Player::Stop()
{
MCIWndStop(m_hVideo);
if(m_hVideo !=NULL)
{
MCIWndDestroy(m_hVideo);
}
return TRUE;
}
出现的错误
错误 1 error C2061: 语法错误 : 标识符“CString” c:\documents and settings\administrator\my documents\visual studio 2008\projects\test_bugs\test_bugs\mp3player.h 17 test_bugs
错误 2 error C2146: 语法错误 : 缺少“;”(在标识符“m_hVideo”的前面) c:\documents and settings\administrator\my documents\visual studio 2008\projects\test_bugs\test_bugs\mp3player.h 21 test_bugs
错误 3 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\documents and settings\administrator\my documents\visual studio 2008\projects\test_bugs\test_bugs\mp3player.h 21 test_bugs
错误 4 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\documents and settings\administrator\my documents\visual studio 2008\projects\test_bugs\test_bugs\mp3player.h 21 test_bugs
错误 5 error C2146: 语法错误 : 缺少“;”(在标识符“FAR”的前面) c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 6 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 7 error C2146: 语法错误 : 缺少“;”(在标识符“PASCAL”的前面) c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 8 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 9 error C2146: 语法错误 : 缺少“;”(在标识符“VideoForWindowsVersion”的前面) c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 10 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 11 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 67 test_bugs
错误 12 error C2146: 语法错误 : 缺少“;”(在标识符“WINAPI”的前面) c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 75 test_bugs
错误 13 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 75 test_bugs
错误 14 error C2146: 语法错误 : 缺少“;”(在标识符“InitVFW”的前面) c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 75 test_bugs
错误 15 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 75 test_bugs
错误 16 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\program files\microsoft sdks\windows\v6.0a\include\vfw.h 75 test_bugs
错误 17 error C2146: 语法错误 : 缺少“;”(在标识符“WINAPI”的前面) c:\program files\microsoft