On-web-up OCX control

Source: Internet
Author: User

Original: http://blog.csdn.net/goodadult2012/article/details/6343369

Using an ActiveX control in an HTML page consists of three basic actions: placing the control in HTML, downloading the control to the user, and installing the control on the user's machine. Inserting an ActiveX control in HTML is easier if it's just for IE users, and more work if you take into account both IE and Netscape users. As you know, the HTML file consists of text and various flags (tags), the ActiveX control for IE in the HTML flag is <OBJECT>, the tag has several important parameter characteristics, they are:
1.ID: Provides an identity name for the control, providing a way for the HTML code to access the control.
2.CLASSID: Is the control's only UUID, which tells IE which object to load. If you use a control that has already been developed, its classid can be found by calling the application regedit under Win95 or NT. Run the program from the Start menu, expand the HKEY_CLASSES_ROOT item, see the alphabetical registry, find the name of the control you want to use, such as WCLNT, when you expand, you can see a CLSID folder, which is the classid of the control.
If you are developing the control yourself with a VC, the UUID can be found in the ODL (Object Description Library) file in the ActiveX control project, and the UUID of a particular control is located by viewing the control's class information comment, for example, to find the UUID of the Cmycontrol control, you need to find the following code:
Class Information for Cmycontrol
[UUID (051C4748-1262-11D2-87C1-00A024D948FB),
Licensed
helpstring ("Cmycontrol control"), control]
The content in parentheses after the UUID is the UUID of the control.
3.CODEBASE: If there is no current version of the control on the user machine, this parameter tells the user where the browser can find the control to download and the latest version number. When the control has been modified, you can change the version number to force the user to re-download.
4.PARAM: The tag is used to set the control's initial property value, which has two attributes: Name and value, which is the property name and property value.
There are also tags, such as width, which indicates the size of the control, height, and so on, and in general, the HTML code for an insert control is very similar to the HTML code that inserts Java applets.
The following is an example of an HTML code embedded with an ActiveX control:
<object id= "Cmycontrol" classid= "CLSID:051C4748-1262-11D2-87C1-00A024D948FB" codebase= "http// www.mysite.com.cn/ocxdir/mycontrol.ocx#version=1,0,0,1 "width=400 height=200 align=center hspace=0 vspace=0 > < /object>
CodeBase settings, if the CAB file and the Web file is saved in the same directory, just write its name, that is, codebase= "mycontrol.ocx#version=1,0,0,1"; #号代表此控件的版本, if the version is different, The client's browser will naturally download the update.
If you want the control can also run in Netscape, in addition to Netscape need to add plug-ins, HTML to add some additional markup, the following example embed is added to the Netscape. If you use MFC to develop the OCX control, the first time a few users in addition to download the OCX file, but also to download the corresponding MFC DLL, download a large quantity, then the relevant files can be packaged in the server side of the client self-extracting installation of the CAB file. The modified HTML snippet is as follows:
<align= "CENTER" classid= "CLSID:
7BCA18C6-2178-11D2-87C1-00A024D948FB "
Width= "height=" id= "marquee"
Codebase= "http://218.168.188.188/scadaweb/
wclnt.cab#version=1,0,0,1 ">
<embed align= "CENTER" classid= "CLSID:7BCA18C6-2178-11D2-87C1-00A024D948FB"
Width= "height=" "" "id=" Marqueequot; "
Codebase= "http://218.168.188.188/scadaweb/
wclnt.ocx#version=1,0,0,1 "
Type= "Application/oleobject" >

On-web-up OCX control

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.