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. Embedding the Player Control in an MFC Project

Embedding the Player Control in an MFC Project

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharphelplearning
5 Posts 2 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.
  • C Offline
    C Offline
    c
    wrote on last edited by
    #1

    I have a dialog based application very simple (visual c++ .net). i added a windows media player control to the dialog resource. next i gave an id IDC_PLAYER. next i added a variable called m_ctrlPlayer(Add Variable). I have also a button (play) and below is the event handler for that button. void CWindowMediaDlg::OnBnClickedPlay() { // TODO: Add your control notification handler code here m_ctrlPlayer.GetControls().play(); } i get this error when i try to compile the project.... error C2039: 'GetControls' : is not a member of 'COcx1' ocx1.h(11) : see declaration of 'COcx1' error C2228: left of '.play' must have class/struct/union type and here is how COcx1 looks... #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. ///////////////////////////////////////////////////////////////////////////// // COcx1 wrapper class class COcx1 : public CWnd { protected: DECLARE_DYNCREATE(COcx1) 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 { amvUninitialized = 0, amvLoading = 1, amvInteractive = 3, amvComplete = 4 }ReadyStateConstants; 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 { mpReadyStateUninitialized = 0, mpReadyStateLoading = 1, mpReadyStateInteractive = 3,

    M 2 Replies Last reply
    0
    • C c

      I have a dialog based application very simple (visual c++ .net). i added a windows media player control to the dialog resource. next i gave an id IDC_PLAYER. next i added a variable called m_ctrlPlayer(Add Variable). I have also a button (play) and below is the event handler for that button. void CWindowMediaDlg::OnBnClickedPlay() { // TODO: Add your control notification handler code here m_ctrlPlayer.GetControls().play(); } i get this error when i try to compile the project.... error C2039: 'GetControls' : is not a member of 'COcx1' ocx1.h(11) : see declaration of 'COcx1' error C2228: left of '.play' must have class/struct/union type and here is how COcx1 looks... #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. ///////////////////////////////////////////////////////////////////////////// // COcx1 wrapper class class COcx1 : public CWnd { protected: DECLARE_DYNCREATE(COcx1) 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 { amvUninitialized = 0, amvLoading = 1, amvInteractive = 3, amvComplete = 4 }ReadyStateConstants; 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 { mpReadyStateUninitialized = 0, mpReadyStateLoading = 1, mpReadyStateInteractive = 3,

      M Offline
      M Offline
      Marc Soleda
      wrote on last edited by
      #2

      Add int the CWindowMediaDlg: #include "wmpcontrols.h" Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.

      1 Reply Last reply
      0
      • C c

        I have a dialog based application very simple (visual c++ .net). i added a windows media player control to the dialog resource. next i gave an id IDC_PLAYER. next i added a variable called m_ctrlPlayer(Add Variable). I have also a button (play) and below is the event handler for that button. void CWindowMediaDlg::OnBnClickedPlay() { // TODO: Add your control notification handler code here m_ctrlPlayer.GetControls().play(); } i get this error when i try to compile the project.... error C2039: 'GetControls' : is not a member of 'COcx1' ocx1.h(11) : see declaration of 'COcx1' error C2228: left of '.play' must have class/struct/union type and here is how COcx1 looks... #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. ///////////////////////////////////////////////////////////////////////////// // COcx1 wrapper class class COcx1 : public CWnd { protected: DECLARE_DYNCREATE(COcx1) 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 { amvUninitialized = 0, amvLoading = 1, amvInteractive = 3, amvComplete = 4 }ReadyStateConstants; 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 { mpReadyStateUninitialized = 0, mpReadyStateLoading = 1, mpReadyStateInteractive = 3,

        M Offline
        M Offline
        Marc Soleda
        wrote on last edited by
        #3

        c+- wrote: i still get errors..... WindowMediaDlg.cpp(5) : fatal error C1083: Cannot open include file: 'wmpcontrols.h': No such file or directory ...where can i get this file... :confused: Quite strange. How have you added Windwos Media to your project? I suppose by "Project > Add to project > Components and Controls > Registered ActiveX Controls > Windows Media Player", isn't it? Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.

        C 1 Reply Last reply
        0
        • M Marc Soleda

          c+- wrote: i still get errors..... WindowMediaDlg.cpp(5) : fatal error C1083: Cannot open include file: 'wmpcontrols.h': No such file or directory ...where can i get this file... :confused: Quite strange. How have you added Windwos Media to your project? I suppose by "Project > Add to project > Components and Controls > Registered ActiveX Controls > Windows Media Player", isn't it? Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.

          C Offline
          C Offline
          c
          wrote on last edited by
          #4

          NO i didn't add it like that. There is no such menu item 'Add to project' under project menu. this is how i added, in resourse view right click on toolbax->Add/remove items->COM components->windows media player then the control appeared on the toolbax, then i added it to dialog. hussein

          M 1 Reply Last reply
          0
          • C c

            NO i didn't add it like that. There is no such menu item 'Add to project' under project menu. this is how i added, in resourse view right click on toolbax->Add/remove items->COM components->windows media player then the control appeared on the toolbax, then i added it to dialog. hussein

            M Offline
            M Offline
            Marc Soleda
            wrote on last edited by
            #5

            I've tried on VC++6 and it works like a charm. I can't test it in a VC.Net environment so there have to be something missing. Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.

            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