我是看了一个程序,基本上都看懂了,就差这个控件的问题了。我是建了一个单文档的程序框架,不支持document。然后加了一个对话框资源,然后Add class ,下一步是在对话框上加一个media player activeX控件,下一步是在控件上添加相应的变量了(变量是m_mediaplayer),就是这一步,别人的实例程序就只有一个基类时CWnd 的类,这个类成为了m_mediaplayer类型了,我查了一些资料说是添加ActiveX控件会生成一个基于CWnd 的类,可是在建工程的时候生成了一个基于CWnd的CCildView类了,而实例程序里只有一个基于CWnd的类!实例程序是有基于CFrameWnd的类的,所以我猜应该是基于单文档的程序!
我现在就是搞不懂,这个控件如何添加,才能像示例程序那样。
#if !defined(AFX_ACTIVEMOVIE3_H__29E79EB8_2F6C_45C2_AF1E_F3C0E0F14723__INCLUDED_)
#define AFX_ACTIVEMOVIE3_H__29E79EB8_2F6C_45C2_AF1E_F3C0E0F14723__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten./////////////////////////////////////////////////////////////////////////////
// CActiveMovie3 wrapper classclass CActiveMovie3 : public CWnd
{
protected:
DECLARE_DYNCREATE(CActiveMovie3)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x5589fa1, 0xc356, 0x11ce, { 0xbf, 0x1, 0x0, 0xaa, 0x0, 0x55, 0x59, 0x5a } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }// Attributes
public:// Operations
public:
void AboutBox();
void Run();
void Pause();
void Stop();
long GetImageSourceWidth();
long GetImageSourceHeight();
CString GetAuthor();
CString GetTitle();
CString GetCopyright();
CString GetDescription();
CString GetRating();
CString GetFileName();
void SetFileName(LPCTSTR lpszNewValue);
double GetDuration();
double GetCurrentPosition();
void SetCurrentPosition(double newValue);
long GetPlayCount();
void SetPlayCount(long nNewValue);
double GetSelectionStart();
void SetSelectionStart(double newValue);
double GetSelectionEnd();
void SetSelectionEnd(double newValue);
long GetCurrentState();
double GetRate();
void SetRate(double newValue);
long GetVolume();
void SetVolume(long nNewValue);
long GetBalance();
void SetBalance(long nNewValue);
BOOL GetEnableContextMenu();
void SetEnableContextMenu(BOOL bNewValue);
BOOL GetShowDisplay();
void SetShowDisplay(BOOL bNewValue);
BOOL GetShowControls();
void SetShowControls(BOOL bNewValue);
BOOL GetShowPositionControls();
void SetShowPositionControls(BOOL bNewValue);
BOOL GetShowSelectionControls();
void SetShowSelectionControls(BOOL bNewValue);
BOOL GetShowTracker();
void SetShowTracker(BOOL bNewValue);
BOOL GetEnablePositionControls();
void SetEnablePositionControls(BOOL bNewValue);
BOOL GetEnableSelectionControls();
void SetEnableSelectionControls(BOOL bNewValue);
BOOL GetEnableTracker();
void SetEnableTracker(BOOL bNewValue);
BOOL GetAllowHideDisplay();
void SetAllowHideDisplay(BOOL bNewValue);
BOOL GetAllowHideControls();
void SetAllowHideControls(BOOL bNewValue);
long GetDisplayMode();
void SetDisplayMode(long nNewValue);
BOOL GetAllowChangeDisplayMode();
void SetAllowChangeDisplayMode(BOOL bNewValue);
LPUNKNOWN GetFilterGraph();
void SetFilterGraph(LPUNKNOWN newValue);
LPDISPATCH GetFilterGraphDispatch();
unsigned long GetDisplayForeColor();
void SetDisplayForeColor(unsigned long newValue);
unsigned long GetDisplayBackColor();
void SetDisplayBackColor(unsigned long newValue);
long GetMovieWindowSize();
void SetMovieWindowSize(long nNewValue);
BOOL GetFullScreenMode();
void SetFullScreenMode(BOOL bNewValue);
BOOL GetAutoStart();
void SetAutoStart(BOOL bNewValue);
BOOL GetAutoRewind();
void SetAutoRewind(BOOL bNewValue);
long GetHWnd();
long GetAppearance();
void SetAppearance(long nNewValue);
long GetBorderStyle();
void SetBorderStyle(long nNewValue);
BOOL GetEnabled();
void SetEnabled(BOOL bNewValue);
BOOL IsSoundCardEnabled();
long GetReadyState();
LPDISPATCH GetMediaPlayer();
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_ACTIVEMOVIE3_H__29E79EB8_2F6C_45C2_AF1E_F3C0E0F14723__INCLUDED_)
这些就是作为m_mediaplayer类型的类了,是不是这些代码都是自动生成的呢?
还是自己写的? 我想真正的理解这个程序,然后自己在写一边,所以请大家帮帮忙!
我现在就是搞不懂,这个控件如何添加,才能像示例程序那样。
#if !defined(AFX_ACTIVEMOVIE3_H__29E79EB8_2F6C_45C2_AF1E_F3C0E0F14723__INCLUDED_)
#define AFX_ACTIVEMOVIE3_H__29E79EB8_2F6C_45C2_AF1E_F3C0E0F14723__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten./////////////////////////////////////////////////////////////////////////////
// CActiveMovie3 wrapper classclass CActiveMovie3 : public CWnd
{
protected:
DECLARE_DYNCREATE(CActiveMovie3)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x5589fa1, 0xc356, 0x11ce, { 0xbf, 0x1, 0x0, 0xaa, 0x0, 0x55, 0x59, 0x5a } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }// Attributes
public:// Operations
public:
void AboutBox();
void Run();
void Pause();
void Stop();
long GetImageSourceWidth();
long GetImageSourceHeight();
CString GetAuthor();
CString GetTitle();
CString GetCopyright();
CString GetDescription();
CString GetRating();
CString GetFileName();
void SetFileName(LPCTSTR lpszNewValue);
double GetDuration();
double GetCurrentPosition();
void SetCurrentPosition(double newValue);
long GetPlayCount();
void SetPlayCount(long nNewValue);
double GetSelectionStart();
void SetSelectionStart(double newValue);
double GetSelectionEnd();
void SetSelectionEnd(double newValue);
long GetCurrentState();
double GetRate();
void SetRate(double newValue);
long GetVolume();
void SetVolume(long nNewValue);
long GetBalance();
void SetBalance(long nNewValue);
BOOL GetEnableContextMenu();
void SetEnableContextMenu(BOOL bNewValue);
BOOL GetShowDisplay();
void SetShowDisplay(BOOL bNewValue);
BOOL GetShowControls();
void SetShowControls(BOOL bNewValue);
BOOL GetShowPositionControls();
void SetShowPositionControls(BOOL bNewValue);
BOOL GetShowSelectionControls();
void SetShowSelectionControls(BOOL bNewValue);
BOOL GetShowTracker();
void SetShowTracker(BOOL bNewValue);
BOOL GetEnablePositionControls();
void SetEnablePositionControls(BOOL bNewValue);
BOOL GetEnableSelectionControls();
void SetEnableSelectionControls(BOOL bNewValue);
BOOL GetEnableTracker();
void SetEnableTracker(BOOL bNewValue);
BOOL GetAllowHideDisplay();
void SetAllowHideDisplay(BOOL bNewValue);
BOOL GetAllowHideControls();
void SetAllowHideControls(BOOL bNewValue);
long GetDisplayMode();
void SetDisplayMode(long nNewValue);
BOOL GetAllowChangeDisplayMode();
void SetAllowChangeDisplayMode(BOOL bNewValue);
LPUNKNOWN GetFilterGraph();
void SetFilterGraph(LPUNKNOWN newValue);
LPDISPATCH GetFilterGraphDispatch();
unsigned long GetDisplayForeColor();
void SetDisplayForeColor(unsigned long newValue);
unsigned long GetDisplayBackColor();
void SetDisplayBackColor(unsigned long newValue);
long GetMovieWindowSize();
void SetMovieWindowSize(long nNewValue);
BOOL GetFullScreenMode();
void SetFullScreenMode(BOOL bNewValue);
BOOL GetAutoStart();
void SetAutoStart(BOOL bNewValue);
BOOL GetAutoRewind();
void SetAutoRewind(BOOL bNewValue);
long GetHWnd();
long GetAppearance();
void SetAppearance(long nNewValue);
long GetBorderStyle();
void SetBorderStyle(long nNewValue);
BOOL GetEnabled();
void SetEnabled(BOOL bNewValue);
BOOL IsSoundCardEnabled();
long GetReadyState();
LPDISPATCH GetMediaPlayer();
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_ACTIVEMOVIE3_H__29E79EB8_2F6C_45C2_AF1E_F3C0E0F14723__INCLUDED_)
这些就是作为m_mediaplayer类型的类了,是不是这些代码都是自动生成的呢?
还是自己写的? 我想真正的理解这个程序,然后自己在写一边,所以请大家帮帮忙!
不要动它,关联一个变量叫m_mediaplayer 就是这个类,类里函数可以这样调用:
m_mediaplayer.xxx()
只有
#pragma once// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten./////////////////////////////////////////////////////////////////////////////
// CActiveMovie3 wrapper classclass CActiveMovie3 : public CWnd
{
protected:
DECLARE_DYNCREATE(CActiveMovie3)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x6BF52A52, 0x394A, 0x11D3, { 0xB1, 0x53, 0x0, 0xC0, 0x4F, 0x79, 0xFA, 0xA6 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
} BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey);
}// Attributes
public:
enum
{
mpReadyStateUninitialized = 0,
mpReadyStateLoading = 1,
mpReadyStateInteractive = 3,
mpReadyStateComplete = 4
}MPReadyStateConstants;
enum
{
mpStopped = 0,
mpPaused = 1,
mpPlaying = 2,
mpWaiting = 3,
mpScanForward = 4,
mpScanReverse = 5,
mpClosed = 6
}MPPlayStateConstants;
enum
{
mpDefaultSize = 0,
mpHalfSize = 1,
mpDoubleSize = 2,
mpFullScreen = 3,
mpFitToSize = 4,
mpOneSixteenthScreen = 5,
mpOneFourthScreen = 6,
mpOneHalfScreen = 7
}MPDisplaySizeConstants;
enum
{
mpTime = 0,
mpFrames = 1
}MPDisplayModeConstants;
enum
{
mpShowURL = 0,
mpClipURL = 1,
mpBannerURL = 2
}MPMoreInfoType;
enum
{
mpShowFilename = 0,
mpShowTitle = 1,
mpShowAuthor = 2,
mpShowCopyright = 3,
mpShowRating = 4,
mpShowDescription = 5,
mpShowLogoIcon = 6,
mpClipFilename = 7,
mpClipTitle = 8,
mpClipAuthor = 9,
mpClipCopyright = 10,
mpClipRating = 11,
mpClipDescription = 12,
mpClipLogoIcon = 13,
mpBannerImage = 14,
mpBannerMoreInfo = 15,
mpWater = 16
}MPMediaInfoType;
enum
{
dvdMenu_Title = 2,
dvdMenu_Root = 3,
dvdMenu_Subpicture = 4,
dvdMenu_Audio = 5,
dvdMenu_Angle = 6,
dvdMenu_Chapter = 7
}DVDMenuIDConstants;
enum
{
mpShowDialogHelp = 0,
mpShowDialogStatistics = 1,
mpShowDialogOptions = 2,
mpShowDialogContextMenu = 3
}MPShowDialogConstants;
// Operations
public:};
这样的代码在ActiveMovie3.h中
不知道你为什么要改?其实改了也没用,这是机器生成的。