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. Static link to ATL alwayas fail

Static link to ATL alwayas fail

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

    I use some ATL functions to create a Media control. But, it seems that I can only use Dynamic link to ATL option, when I switch to Static link to ATL. I just can't create the control successfully. I'm so confused. Anyone can help me?

    //related headers
    #include
    #include
    #include
    #include
    #include

    //related vars
    CAxWindow m_wndView; // ActiveX host window class. CComPtr
    m_spWMPPlayer; // Smart pointer to IWMPPlayer interface.

    //related function code:
    CComPtr spHost;
    HRESULT hr;
    m_wndView.Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
    hr = m_wndView.QueryHost(&spHost);
    /*
    when I switch to "Static Link to ATL" option, I will fail here
    E_FAIL == hr;//the failure flag
    */
    if(!SUCCEEDED(hr)) return FALSE;

    hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);
    if(!SUCCEEDED(hr)) return FALSE;

    hr = m_wndView.QueryControl(&m_spWMPPlayer);
    if(!SUCCEEDED(hr)) return FALSE;

    L 1 Reply Last reply
    0
    • F Falconapollo

      I use some ATL functions to create a Media control. But, it seems that I can only use Dynamic link to ATL option, when I switch to Static link to ATL. I just can't create the control successfully. I'm so confused. Anyone can help me?

      //related headers
      #include
      #include
      #include
      #include
      #include

      //related vars
      CAxWindow m_wndView; // ActiveX host window class. CComPtr
      m_spWMPPlayer; // Smart pointer to IWMPPlayer interface.

      //related function code:
      CComPtr spHost;
      HRESULT hr;
      m_wndView.Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
      hr = m_wndView.QueryHost(&spHost);
      /*
      when I switch to "Static Link to ATL" option, I will fail here
      E_FAIL == hr;//the failure flag
      */
      if(!SUCCEEDED(hr)) return FALSE;

      hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);
      if(!SUCCEEDED(hr)) return FALSE;

      hr = m_wndView.QueryControl(&m_spWMPPlayer);
      if(!SUCCEEDED(hr)) return FALSE;

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You need to look at the actual error code value when you get a FAIL result, in order to see why it has failed.

      One of these days I'm going to think of a really clever signature.

      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