Click to See Complete Forum and Search --> : MediaPlayer


fwehlin
April 23rd, 1999, 06:23 PM
Hi,
What I have done is that I´ve made a dialogbased application with about 10
buttons on the main-dialog. The buttons have fuctions like openfile, exit,
play, stop and pause. When opening a file I want to create a MediaPlayer
window and show it on the screen. What happens now is that this window
(Mediaplayer) is shown inside the maindialog. The code for my
OnOpenFile-function is:

void MainDlg::OnOpenFile()
{
static char BASED_CODE szFilter[] = "Mpeg Files
(*.mpg;*.mpeg)|*.mpg;*.mpeg|Avi Files (*.avi)|*.avi|Movie Files
(*.mov;)|*.mov|All Files (*.*)|*.*||";

CFileDialog filedlg(TRUE,"*.mpeg;*.mpg",NULL,OFN_READONLY|
OFN_LONGNAMES|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST,szFilter,this);

filedlg.m_ofn.lpstrInitialDir = _T("C:\\dload");
filedlg.DoModal();

CRect r;
r.SetRect(0,0,300,300);
MPlayer.Create("MediaSpelaren", WS_POPUP,r,this,NULL,NULL,FALSE);
MPlayer.ShowWindow(SW_SHOW);
MPlayer.UpdateWindow();
MPlayer.SetFileName(filedlg.GetPathName());
}

Where MPlayer is a membervariable of CMediaPlayer.

Any clues how I can get it to play outside the Maindialog, and on the screen
??

Plz help I´m stuck

Thanx Frederik.

P.S here is the Create-function for CMediaPlayer:

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); }

D.S