views:

784

answers:

3

Hi,

I have ActiveX control done in VC++/MFC. It embeds into html web page. Now I need to be able to configure it by providing parameters in html tag. like: The question is how do I read those parameters during my ActiveX initialization? My research revealed that it has to be done through IPersistPropertyBag interface, but I could really use some code examples to figure that out.

Any examples in VC++ please?

Thanks, Mike

A: 

Could someone please help on this one?

+1  A: 

I will answer my own question...
Basically from ActiveX point of view those HTML parameters are "persistent storage" parameters.
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(""));
}
Ma99uS