【问题标题】:How to read <object> <PARAM> properties in ActiveX web control with VC++/MFC如何使用 VC++/MFC 读取 ActiveX Web 控件中的 <object> <PARAM> 属性
【发布时间】:2010-11-05 11:01:46
【问题描述】:

我在 VC++/MFC 中完成了 ActiveX 控件。它嵌入到 html 网页中。现在我需要能够通过在 html 标签中提供参数来配置它。喜欢: 问题是如何在 ActiveX 初始化期间读取这些参数?我的研究表明它必须通过 IPersistPropertyBag 接口来完成,但我真的可以使用一些代码示例来解决这个问题。

请问有VC++的例子吗?

谢谢, 迈克

【问题讨论】:

    标签: html visual-c++ activex


    【解决方案1】:

    我会回答我自己的问题...
    从 ActiveX 的角度来看,这些 HTML 参数基本上是“持久存储”参数。
    所以在你的 HTML 文件中:

    <OBJECT ID="activex1" WIDTH=300 HEIGHT=200
        ...
        <PARAM NAME="ServerAddress" VALUE="192.168.1.1:1234">
        ...
    </OBJECT>
    

    在您的 MFC ActiveX 控件中:

    void Cubcam_activexCtrl::DoPropExchange(CPropExchange* pPX)
    {
        ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
        COleControl::DoPropExchange(pPX);
    
        // TODO: Call PX_ functions for each persistent custom property.
        PX_String(pPX, _T("ServerAddress"), m_serverAddress, _T(""));
    }
    

    【讨论】:

      【解决方案2】:

      有趣;我将不得不尝试您描述的方法。我知道的方法是实现 IPersistPropertyBag 接口并实现 Load 方法。

      我没有用过 MFC,只用过 ATL,但我是手动实现的。我将不得不研究您提供的解决方案,看看 MFC 使用的底层方法是否有优势。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-07-20
        • 2011-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-26
        • 1970-01-01
        • 2011-01-10
        相关资源
        最近更新 更多