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. C / C++ / MFC
  4. cocreateinstance and windows media player

cocreateinstance and windows media player

Scheduled Pinned Locked Moved C / C++ / MFC
helplearning
6 Posts 3 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.
  • S Offline
    S Offline
    Scozturk
    wrote on last edited by
    #1

    Hi, I am trying to create an istance of the windows media player control but it returns an error... here is my code: HRESULT hret; IUnknown *pUnknown; MediaPlayer::IMediaPlayerPtr pMediaPlayer = NULL; IConnectionPoint *pConnectionPoint; IConnectionPointContainer *pConnectionPointContainer; IOleInPlaceObject *pInPlaceObject; IOleObject *pObject; DWORD dwAdviseCookie; hret = CoCreateInstance(__uuidof(MediaPlayer::IMediaPlayerPtr), NULL, CLSCTX_ALL, pMediaPlayer.GetIID(), (void**)(&pMediaPlayer)); Thank you very much for your answers in advance... Well... I am a beginner ...

    M M 2 Replies Last reply
    0
    • S Scozturk

      Hi, I am trying to create an istance of the windows media player control but it returns an error... here is my code: HRESULT hret; IUnknown *pUnknown; MediaPlayer::IMediaPlayerPtr pMediaPlayer = NULL; IConnectionPoint *pConnectionPoint; IConnectionPointContainer *pConnectionPointContainer; IOleInPlaceObject *pInPlaceObject; IOleObject *pObject; DWORD dwAdviseCookie; hret = CoCreateInstance(__uuidof(MediaPlayer::IMediaPlayerPtr), NULL, CLSCTX_ALL, pMediaPlayer.GetIID(), (void**)(&pMediaPlayer)); Thank you very much for your answers in advance... Well... I am a beginner ...

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      What error are you getting? Did you call CoInitialize() before the CoCreateInstance? Michael CP Blog [^]

      S 1 Reply Last reply
      0
      • M Michael P Butler

        What error are you getting? Did you call CoInitialize() before the CoCreateInstance? Michael CP Blog [^]

        S Offline
        S Offline
        Scozturk
        wrote on last edited by
        #3

        I called OleInitialize... But I cant get the written error message... can someone help? Well... I am a beginner ...

        1 Reply Last reply
        0
        • S Scozturk

          Hi, I am trying to create an istance of the windows media player control but it returns an error... here is my code: HRESULT hret; IUnknown *pUnknown; MediaPlayer::IMediaPlayerPtr pMediaPlayer = NULL; IConnectionPoint *pConnectionPoint; IConnectionPointContainer *pConnectionPointContainer; IOleInPlaceObject *pInPlaceObject; IOleObject *pObject; DWORD dwAdviseCookie; hret = CoCreateInstance(__uuidof(MediaPlayer::IMediaPlayerPtr), NULL, CLSCTX_ALL, pMediaPlayer.GetIID(), (void**)(&pMediaPlayer)); Thank you very much for your answers in advance... Well... I am a beginner ...

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

          Without knowing the error (post the return value from CoCreateInstance()) I can only guess, but the first parameter looks like an IID, not a CLSID. You need to put the CLSID of the WMP object there. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."   -- Paul Watson, Linux Zombie

          S 1 Reply Last reply
          0
          • M Michael Dunn

            Without knowing the error (post the return value from CoCreateInstance()) I can only guess, but the first parameter looks like an IID, not a CLSID. You need to put the CLSID of the WMP object there. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."   -- Paul Watson, Linux Zombie

            S Offline
            S Offline
            Scozturk
            wrote on last edited by
            #5

            ...ok I fixed the classid thing like this: CLSID idMediaPlayer; HRESULT hr = ::CLSIDFromProgID (L"WMPlayer.OCX.1", &idMediaPlayer); Well I was using windows media player 8 but I found that I jammed up the class-id... then I installed Windows Media Player 9... The error code is: "REGDB_E_CLASSNOTREG" ... I am not sure if I have to use "msdxm.ocx" for windows media player 9... Well... I am a beginner ...

            S 1 Reply Last reply
            0
            • S Scozturk

              ...ok I fixed the classid thing like this: CLSID idMediaPlayer; HRESULT hr = ::CLSIDFromProgID (L"WMPlayer.OCX.1", &idMediaPlayer); Well I was using windows media player 8 but I found that I jammed up the class-id... then I installed Windows Media Player 9... The error code is: "REGDB_E_CLASSNOTREG" ... I am not sure if I have to use "msdxm.ocx" for windows media player 9... Well... I am a beginner ...

              S Offline
              S Offline
              Scozturk
              wrote on last edited by
              #6

              I have to use wmp.dll and WMPlayer.OCX.7 is just working fine thanks a lot! Well... I am a beginner ...

              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