【问题标题】:Custom Flash ActiveX Host - Relative paths自定义 Flash ActiveX 主机 - 相对路径
【发布时间】:2009-07-17 11:29:30
【问题描述】:

好的,让它正常工作是一场噩梦,所以我决定为其他人提供这个。

托管 flash activex 要求您使用实现 SetClass(可以是无操作)的 IStorage 和实现以下功能的 IOleClientSite 调用 OleCreate:

IOleInPlaceSiteEx:
    OnInPlaceActivateEx() (no-op)
    GetWindow()
    GetWindowContext()
IOleClientSite:
    ShowObject() (no-op)

但是,加载的 swf 访问的任何外部资源都必须是完全限定的,否则它将失败并出现如下错误:

Error #2032: Stream Error. URL: file://<relative path>

我正在发布我想出的答案,告诉我这是否不是适当的 Stackettique。

【问题讨论】:

    标签: flash activex


    【解决方案1】:

    要解决此问题,您的 IOleClientSite 还必须实现 IServiceProvider::QueryService() 以返回实现 CreateMoniker() 的 IBindHost:

    return CreateURLMonikerEx(pmkBase, szName, ppmk, URL_MK_UNIFORM);
    

    其中 pmkBase 是一个 URL Moniker,其中包含您的基本路径,例如:

    OLECHAR szPath[MAX_PATH];
    int cch = ::GetCurrentDirectory(ARRAYSIZE(szPath), szPath);
    // GetCurrentDirectory does not finish with \, which causes the top directory to be removed :(
    // Also, error checking is for pansies.
    szPath[cch++] = L'\\';
    szPath[cch++] = 0;
    CreateURLMonikerEx(0, szPath, &pmkBase, URL_MK_UNIFORM);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多