CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    Russia, Taganrog
    Posts
    1

    Resizing of WME preview window in ATL COM object

    Hi, All

    I created WMEncoder preview window embedded into my ATL COM object. When I resize the object, preview image doesn't change it's size. I can adjust preview size only by restarting encoder and creating preview object. This causes large delays and makes resizing very difficult for the user. However, when WME creates preview itself (in new window), this win can be easily resized. How WME does it?

    Current code for updating preview is as follows:

    STDMETHODIMP CEncoderCtl::UpdateView()
    {
    HRESULT hr;

    Stop();
    hr = pPreviewColl->RemoveAll();
    m_pPreview->Release();

    hr = CoCreateInstance( CLSID_WMEncPreview,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_IWMEncDataView,
    (void**)&m_pPreview);

    m_lCookie = -1;

    hr = pPreviewColl->Add(m_pPreview, &m_lCookie);

    hr = m_pEncoder->PrepareToEncode(VARIANT_TRUE);

    hr = m_pPreview->SetViewSetting((DWORD) m_lCookie,
    sizeof(m_hWnd),
    (BYTE*)&m_hWnd);
    Start();

    return S_OK;
    }

    STDMETHODIMP CEncoderCtl::Start()
    {
    HRESULT hr;
    if (m_lState != ENC_STATE_READY) return E_FAIL;
    hr = m_pEncoder->Start();
    hr = m_pPreview->Start(m_lCookie);
    m_lState = ENC_STATE_RUNNING;

    return S_OK;
    }

    STDMETHODIMP CEncoderCtl::Stop()
    {
    HRESULT hr;
    if (m_lState != ENC_STATE_RUNNING) return E_FAIL;
    m_lState = ENC_STATE_READY;
    hr = m_pPreview->Stop(m_lCookie);
    hr = m_pEncoder->Stop();
    hr = m_pEncoder->PrepareToEncode(VARIANT_FALSE);

    return S_OK;
    }

    Respectfully,
    Alex Orlov

  2. #2
    Join Date
    Jan 2006
    Posts
    1

    Re: Resizing of WME preview window in ATL COM object

    Yes,I have same problem , but the pop window by encoder sdk can resize video window smooth.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured