wangchyz / duilib_googlecode

从google code备份过来,仅作存档
https://github.com/duilib/duilib
8 stars 10 forks source link

关于在TAB页中显示FLASH的问题 #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
我把flash放在一个TAB页中现实,当切换TAB的时候,整个界面就
没了,。只有进程里面有个进程在跑。。这是怎么回事。。��
�面是flash显示和tab切换的代码。。。
else if( msg.sType == _T("showactivex") ) 
    {
        if( msg.pSender->GetName() != _T("flash") ) 
            return;
        IShockwaveFlash* m_pFlash = NULL;
        CActiveXUI* m_pActiveX = static_cast<CActiveXUI*>(msg.pSender);
        m_pActiveX->GetControl(IID_IUnknown, (void**)&m_pFlash);
        if( m_pFlash != NULL ) 
        {
            m_pFlash->put_WMode( _bstr_t(_T("Transparent") ) );
            m_pFlash->put_Movie( _bstr_t(CPaintManagerUI::GetInstancePath() + _T("Ui\\test.swf")) );
            m_pFlash->DisableLocalSecurity();
            m_pFlash->put_AllowScriptAccess(L"always");
            BSTR response;
            m_pFlash->CallFunction(L"<invoke name=\"setButtonText\" returntype=\"xml\"><arguments><string>Click me!</string></arguments></invoke>", &response);
            m_pFlash->Release();
        }  
    }
    else if(msg.sType==_T("selectchanged"))
    {
        CStdString name = msg.pSender->GetName();
        CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("TabLayoutUI1")));
        if(name==_T("knowdev"))
        {
            pControl->SelectItem(0);
        }
        else if(name==_T("connect"))
        {
            pControl->SelectItem(1);
        }
        else if(name==_T("syscheck"))
        {
            pControl->SelectItem(2);
        }

    }

Original issue reported on code.google.com by andywei...@gmail.com on 26 Sep 2011 at 1:08

GoogleCodeExporter commented 9 years ago
这个问题是 CActiveXUI中的BUG
void CActiveXUI::SetVisible(bool bVisible)
{
    CControlUI::SetVisible(bVisible);
    if( m_hwndHost != NULL ) ::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
}

void CActiveXUI::SetInternVisible(bool bVisible)
{
    CControlUI::SetInternVisible(bVisible);
    if( m_hwndHost != NULL ) ::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
}

当切换tab页的时候,隐藏activex控件导致整个 window被隐藏,
改为下面就好了:
void CActiveXUI::SetVisible(bool bVisible)
{
    CControlUI::SetVisible(bVisible);
    if( m_hwndHost != NULL ) //::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
    {   

        if (bVisible == false)
        {
             SetPos(CRect(0,0,0,0));
        }
        else
        {
             SetPos(m_rcItem);
        }

    }
}

void CActiveXUI::SetInternVisible(bool bVisible)
{
    CControlUI::SetInternVisible(bVisible);
   // if( m_hwndHost != NULL ) //::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
    if( m_hwndHost != NULL ) //::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
    {   
        if (bVisible == false)
        {
            SetPos(CRect(0,0,0,0));
        }
        else
        {
            SetPos(m_rcItem);
        }

    }
}

Original comment by andywei...@gmail.com on 27 Sep 2011 at 3:32

GoogleCodeExporter commented 9 years ago
是不是用了windowless的flash控件?
改成这样行不行呢

void CActiveXUI::SetVisible(bool bVisible)
{
    CControlUI::SetVisible(bVisible);
    if( m_hwndHost != NULL && !m_pControl->m_bWindowless ) 
        ::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
}

void CActiveXUI::SetInternVisible(bool bVisible)
{
    CControlUI::SetInternVisible(bVisible);
    if( m_hwndHost != NULL && !m_pControl->m_bWindowless ) 
        ::ShowWindow(m_hwndHost, IsVisible() ? SW_SHOW : SW_HIDE);
}

Original comment by wangc...@gmail.com on 27 Sep 2011 at 2:52

GoogleCodeExporter commented 9 years ago
对,是用了windowless的flash控件,,按照你的方法可以,谢谢��
�哈!
另外,问下,这个库怎么显示gif动画,,我找了个ImageOle.dll��
�示gif控件,但是gif不动,只能显示一帧。是怎么回事呢?谢�
��!

if (msg.pSender->GetName() ==_T("gif"))
{

    ImageOleLib::IGifAnimator * m_pgif = NULL;

            CActiveXUI* m_pActiveX = static_cast<CActiveXUI*>(msg.pSender);

            //获取接口

            if (m_pgif  != NULL)
            {

               m_pgif->LoadFromFile(_bstr_t(CPaintManagerUI::GetInstancePath() + _T("Ui\\load.gif")));

               m_pgif->TriggerFrameChange();

               m_pgif->Release();

            }

        }

    }

Original comment by andywei...@gmail.com on 28 Sep 2011 at 4:39

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by wangc...@gmail.com on 28 Sep 2011 at 6:25