Example of assigning a property to an ActiveX control by param name in a Web page

Source: Internet
Author: User

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 (""));
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.