Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Controlling the MediaPlayer ocx control

Controlling the MediaPlayer ocx control

Scheduled Pinned Locked Moved ATL / WTL / STL
questionc++comhardwarehelp
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bryces
    wrote on last edited by
    #1

    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

    A M R 3 Replies Last reply
    0
    • B bryces

      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

      A Offline
      A Offline
      Abhishek Srivastava
      wrote on last edited by
      #2

      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 :)

      B A 2 Replies Last reply
      0
      • A Abhishek Srivastava

        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 :)

        B Offline
        B Offline
        bryces
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • A Abhishek Srivastava

          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 :)

          A Offline
          A Offline
          Abhishek Srivastava
          wrote on last edited by
          #4

          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 :)

          B 1 Reply Last reply
          0
          • B bryces

            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

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            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

            B 1 Reply Last reply
            0
            • M Michael Dunn

              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

              B Offline
              B Offline
              bryces
              wrote on last edited by
              #6

              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

              M 1 Reply Last reply
              0
              • B bryces

                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

                M Offline
                M Offline
                Michael Dunn
                wrote on last edited by
                #7

                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?

                1 Reply Last reply
                0
                • A Abhishek Srivastava

                  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 :)

                  B Offline
                  B Offline
                  bryces
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  • B bryces

                    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

                    R Offline
                    R Offline
                    rbeckett
                    wrote on last edited by
                    #9

                    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

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups