当前位置:软件学习 > Flash >>

c++播放Flash文件

最近由于需要在程序中使用Flash播放,所以学习了下如何播放Flash,这里使用atl库中的CAxWindow来处理我们要播放的Flash!由于Flash的很多接口我们都不知道,所以可以
这篇文章中介绍了如何导出Flash的接口,这篇文章主要介绍一下,Flash的时间的通知,以及如何利用windows的API,进行两个Flash的混合播放!新建一个默认的 win32窗口程序,然后加入后面的头文件,这里主要是加入atl库文件,以及adobe公司的flash的ocx控件。[cpp]
PRE class=cpp name="code"><SPAN style="FONT-SIZE: 14px">#include <atlbase.h> 
extern CComModule _Module; 
#include <atlwin.h>  
#include <comdef.h>  
#include "flash32_11_7_700_224.tlh"  
#include <string>  
using namespace std; 
using namespace ShockwaveFlashObjects;</SPAN></PRE><PRE class=cpp name="code"><SPAN style="FONT-SIZE: 14px">CComModule _Module;</SPAN></PRE><SPAN style="FONT-SIZE: 14px"><BR> 
</SPAN> 
<PRE></PRE> 
<SPAN style="FONT-SIZE: 14px">然后我们建立个Flash事件的处理类:</SPAN><PRE class=cpp name="code"><SPAN style="FONT-SIZE: 14px">class FlashSink : public ShockwaveFlashObjects::_IShockwaveFlashEvents    
{    
public:     
    LPCONNECTIONPOINT       m_ConnectionPoint;      
    DWORD                   m_dwCookie;    
    int                     m_nRefCount; 
 
public:    
    FlashSink()    
    {           
        m_dwCookie = 0;    
        m_ConnectionPoint = NULL;    
        m_nRefCount = 0;    
    }    
 
    virtual ~FlashSink()    
    {    
 
    }    
 
    HRESULT Init(CComPtr<IShockwaveFlash> ptrFlash)    
    {    
        HRESULT aResult = NOERROR;    
        LPCONNECTIONPOINTCONTAINER aConnectionPoint = NULL;    
        if ((ptrFlash->QueryInte易做图ce(IID_IConnectionPointContainer, (void**) &aConnectionPoint) == S_OK) &&    
            (aConnectionPoint->FindConnectionPoint(__uuidof(ShockwaveFlashObjects::_IShockwaveFlashEvents), &m_ConnectionPoint) == S_OK))                
        {    
            IDispatch* aDispatch = NULL;    
            QueryInte易做图ce(__uuidof(IDispatch), (void**) &aDispatch);    
            if (aDispatch != NULL)    
            {    
                aResult = m_ConnectionPoint->Advise((LPUNKNOWN)aDispatch, &m_dwCookie);    
                aDispatch->Release();    
            }    
        }    
 
        if (aConnectionPoint != NULL)     
            aConnectionPoint->Release();    
 
        return aResult;    
    }    
 
    HRESULT Shutdown()    
    {    
        HRESULT aResult = S_OK;    
 
        if (m_ConnectionPoint)    
        {    
            if (m_dwCookie)    
            {    
                aResult = m_ConnectionPoint->Unadvise(m_dwCookie);    
                m_dwCookie = 0;    
            }    
 
            m_ConnectionPoint->Release();    
            m_ConnectionPoint = NULL;    
        }    
 
        return aResult;    
    }    
 
    HRESULT STDMETHODCALLTYPE QueryInte易做图ce(REFIID riid, LPVOID* ppv)    
    {    
        *ppv = NULL;    
 
        if (riid == IID_IUnknown)    
        {    
            *ppv = (LPUNKNOWN)this;    
            AddRef();    
            return S_OK;    
        }    
        else if (riid == IID_IDispatch)    
        {    
            *ppv = (IDispatch*)this;    
            AddRef();    
            return S_OK;    
&nb
补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,