How to read <object> <PARAM> properties in ActiveX web control using VC ++ / MFC

I have an ActiveX control in VC ++ / MFC. It is embedded in the html page. Now I need to customize it by specifying parameters in the html tag. how: The question is, how can I read these parameters during ActiveX initialization? My research showed that this needs to be done through the IPersistPropertyBag interface, but I could actually use some code examples to figure it out.

Any examples in VC ++ please?

Thanks, Mike

+1


a source to share


2 answers


I'll answer my own question ...
Basically from an ActiveX perspective, these HTML options are "persistent" options.
So, in your HTML file:

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

      



And in your MFC ActiveX control:

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


a source


Interesting; I will have to try the method you describe. The way I know is to implement the IPersistPropertyBag interface and implement the Load method.



I didn't use MFC, just ATL, but I implemented it manually. I will need to study your suggested solution to see if there are benefits to the basic approach used by MFC.

0


a source







All Articles