代码之家  ›  专栏  ›  技术社区  ›  CDR

如何在纯C中播放flash文件?

  •  2
  • CDR  · 技术社区  · 17 年前

    我正在寻找一个Windows DLL的参考,比如flash_player.DLL(如果有的话)和文档。或者至少是一个COM/ActiveX控件。请注意,ActiveX在C中比在VB中更难使用。

    1 回复  |  直到 17 年前
        1
  •  4
  •   joe    17 年前

    使用的代码来自: http://support.microsoft.com/kb/218442/EN-US/

    //*Place at the top of your CAxDialogImpl class
    #import "flash.ocx" rename_namespace( "FLASH")
    FLASH::IShockwaveFlashPtr m_spFlash;
    
    
    //This code gets added to your OnInitDialog function of the window
    LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
    CAxWindow wnd;
    CLSID clsid;
    LPUNKNOWN pUnkCtrl, pUnkCont;
    HRESULT hr = CLSIDFromString(OLESTR("{D27CDB6E-AE6D-11CF-96B8-444553540000}"), &clsid);
    hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown,
    (void**)&pUnkCtrl);
    CComQIPtr <IPersistStreamInit> spPerStm(pUnkCtrl);
    spPerStm->InitNew();
    
    m_spFlash = pUnkCtrl;
    wnd.Attach(m_hWnd);
    wnd.AttachControl(pUnkCtrl, &pUnkCont);
    
    m_spFlash->PutMovie( _bstr_t(_T("C:\\Documents and Settings\\murk\\Desktop\\Chlorine\\ccc_main.swf")));
    }