The idea of assigning values to an ActiveX control's properties by param name is good. Interested friends can see the specific implementation, I hope to help you
Copy Code code as follows:
<HTML>
<HEAD>
<title>test activex</title>
<object id= "Testctrl" name= "<span style=" Font-family:arial,helvetica,sans-serif ">TestCtrl</span" ><span style= "Font-family:arial,helvetica,sans-serif" > "</span>
codebase= "Calc. cab#version=1,0,0,1 "
classid= "clsid:cdf1d789-f8a3-48f2-b0de-0d72f2d89f76" >
<param name= "Downpath" value= 123456 "/>"
</OBJECT>
<script language= "JavaScript" >
function dotest ()
{
Alert (<span style= "Font-family:arial,helvetica,sans-serif" >testctrl</span><span style=) Font-family:arial,helvetica,sans-serif ">.</span><span style=" Font-family:arial,helvetica,sans-serif ">downpath</span><span style=" Font-family:arial,helvetica,sans-serif ">);</span>
}
</script>
</HEAD>
<BODY>
<input type= "button" value= "Get left Time" id= Btnok "onclick=" dotest (); " ></input>
</BODY>
</HTML>
If you create a property type that is BSTR and the variable name is Downpath, add the following code:
Select the member variable method when creating the property, and then add the following code in the following code
Copy Code code as follows:
void Cocxtestctrl::D opropexchange (cpropexchange* ppx)
{
ExchangeVersion (ppx, Makelong (_wverminor, _ Wvermajor));
COleControl::D opropexchange (PPX); The
//Todo:call px_ functions for each persistent the custom property.
Px_string (ppx, _t ("Downpath"), M_downpath, _t (""));
}