Controlling the MediaPlayer ocx control
-
Hi All, I am in the process of developing an ATL/COM extension for an application in which I have embedded the Windows Media Player ocx COM Control into an ATLDialog object. How do I get control of this object so that I can change the video being displayed? I guess if it was a CDialog I could use the appwizard to map the control to member variable. How do I do this for an ATL Dialog? Do I get the handle and then ...... You help would be greatly appreciated cheers Bryce
-
Hi All, I am in the process of developing an ATL/COM extension for an application in which I have embedded the Windows Media Player ocx COM Control into an ATLDialog object. How do I get control of this object so that I can change the video being displayed? I guess if it was a CDialog I could use the appwizard to map the control to member variable. How do I do this for an ATL Dialog? Do I get the handle and then ...... You help would be greatly appreciated cheers Bryce
Hi , U can use GetDlgItem(IDC_MEDIACONTROL1) , this will return u the handle of the media control window now create a CWnd object attach this media control handle . HWND hwn=GetDlgItem(IDC_MEDIACONTROL1) CWnd * wnd=new CWnd();l wnd->Attach(hwn); then call wnd->GetControlUnknown()..this will return u the IUnknown Pointer. Using this pointer query for other media control interfaces..and enjoy coding byee..hope this solves ur problem :) ' Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)
-
Hi , U can use GetDlgItem(IDC_MEDIACONTROL1) , this will return u the handle of the media control window now create a CWnd object attach this media control handle . HWND hwn=GetDlgItem(IDC_MEDIACONTROL1) CWnd * wnd=new CWnd();l wnd->Attach(hwn); then call wnd->GetControlUnknown()..this will return u the IUnknown Pointer. Using this pointer query for other media control interfaces..and enjoy coding byee..hope this solves ur problem :) ' Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)
Hi Abhishek, Thankyou for your help. I have done what you said above, but need a little more guidance. When you say at the end "Using this pointer query for other media control interfaces..and enjoy coding"... what is the other media control interfaces? What interfaces/objects should I be aiming to query too...? I want to be able to do something like.... HWND hwn=GetDlgItem(IDC_MEDIACONTROL1) CWnd * wnd=new CWnd(); wnd->Attach(hwn); IUnknownPtr pUnknown; pUnknown = GetControlUnknown(); //....... //Query interface to some type of MediaPlayer object IMediaPlayerPtr pMyPretendMediaPlayerObject; //any ideas on the correct interface? pMyPretendMediaPlayerObject->Open("The path to the file I want"); pMyPretendMediaPlayerObject->Play(); //....... Does the logic for this seem ok.... or could you point me to somewhere I could read up on this. thanks for your help cheers Bryce
-
Hi , U can use GetDlgItem(IDC_MEDIACONTROL1) , this will return u the handle of the media control window now create a CWnd object attach this media control handle . HWND hwn=GetDlgItem(IDC_MEDIACONTROL1) CWnd * wnd=new CWnd();l wnd->Attach(hwn); then call wnd->GetControlUnknown()..this will return u the IUnknown Pointer. Using this pointer query for other media control interfaces..and enjoy coding byee..hope this solves ur problem :) ' Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)
Hi once again, sorry for not making myself so clear.. actually i mean using that IUnknown Pointer like IUnknown *unk=wnd->GetControlUnknown(); Query for other interfaces like this IMediaPlayer *mediaplayer unk->QueryInterface(IID_IMediaPlayer,(void **)&mediaplayer); in the same way all other interfaces that Windows Media Control Supports ..u can see supported interface in VB Object Browser(by addding Control in a VB and browse that object .using utility object browser). So ...tell me if it worked..and i am making myself clear!! :) Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)
-
Hi All, I am in the process of developing an ATL/COM extension for an application in which I have embedded the Windows Media Player ocx COM Control into an ATLDialog object. How do I get control of this object so that I can change the video being displayed? I guess if it was a CDialog I could use the appwizard to map the control to member variable. How do I do this for an ATL Dialog? Do I get the handle and then ...... You help would be greatly appreciated cheers Bryce
Check out WTL for MFC Programmers, Part VI - Hosting ActiveX Controls[^] --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer. -- Michael P. Butler in the Lounge
-
Check out WTL for MFC Programmers, Part VI - Hosting ActiveX Controls[^] --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer. -- Michael P. Butler in the Lounge
Hi Michael, Thanks for the pointer to your articles! nice to read the background info on why certain things have to be done. The WTL example that you posted was with a com server (.exe). Does having my extension with activex control change many things if it is in a DLL? Cheers Bryce
-
Hi Michael, Thanks for the pointer to your articles! nice to read the background info on why certain things have to be done. The WTL example that you posted was with a com server (.exe). Does having my extension with activex control change many things if it is in a DLL? Cheers Bryce
Nothing comes to mind... as long as you can create a
CAxDialogImpl
you can host controls. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Pinky, are you pondering what I'm pondering? I think so Brain, but how will we fit the hamster inside the accordion? -
Hi once again, sorry for not making myself so clear.. actually i mean using that IUnknown Pointer like IUnknown *unk=wnd->GetControlUnknown(); Query for other interfaces like this IMediaPlayer *mediaplayer unk->QueryInterface(IID_IMediaPlayer,(void **)&mediaplayer); in the same way all other interfaces that Windows Media Control Supports ..u can see supported interface in VB Object Browser(by addding Control in a VB and browse that object .using utility object browser). So ...tell me if it worked..and i am making myself clear!! :) Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)
Hi Abhishek, Yep looking at the VB object browser was a good idea. I have foudn one reason why it was not possible working.... I forgot to import the ocx object definition for the MediaPlayer (msdxm.ocx). However, when I define the IMediaPlayer the compiler doesn't have a clue about what to do. C:\DEVELOPMENT\VideoTool\SelectedWin.cpp(18) : error C2065: 'IMediaPlayer' : undeclared identifier C:\DEVELOPMENT\VideoTool\SelectedWin.cpp(18) : error C2065: 'mediaplayer' : undeclared identifier C:\DEVELOPMENT\VideoTool\SelectedWin.cpp(18) : warning C4552: '*' : operator has no effect; expected operator with side-effect I getting pretty frustrated why it seems so complex to something that should be simple. I am relatively new to ATL MFC etc.... but this should be a walk in the park. thanks for your help cheers Bryce
-
Hi All, I am in the process of developing an ATL/COM extension for an application in which I have embedded the Windows Media Player ocx COM Control into an ATLDialog object. How do I get control of this object so that I can change the video being displayed? I guess if it was a CDialog I could use the appwizard to map the control to member variable. How do I do this for an ATL Dialog? Do I get the handle and then ...... You help would be greatly appreciated cheers Bryce
The Windows Media Player SDK has an example of this called "WMPML" which can be downloaded with the SDK at www.windowsmedia.com It implements a big CAxDialog, but it doesn't compile! I haven't bothered trying to fix it, but it's probably what you're looking for. Ryan