Releases the MFC ActiveX Control and implements automatic updates.

Source: Internet
Author: User

I.


Introduction

In the previous article, we talked about how to use
Developed by VC 2005
We developed the MFC ActiveX control.
ActiveX controls aim
ActiveX control is released and embedded in
Web pages are automatically updated on the client browser as the control version is updated. Let's talk about the implementation in this article.

Tools used:
PackageForTheWeb

II.


Compile

ActiveX

Widget

Before release, we 'd better use
VS2005 compiles controls into"
The Release version is worth noting that we are using
MFC class library for development
When using ActiveX controls, consider whether the client has
The MFC class library provides two solutions:

1.

In the following package
MFC class library
DLL attached.

2.

Open the Project Properties dialog box through "project"-"" properties ",
"Use of MFC" is set to "use in static library
". For example:


Click "OK" to save the configuration information.
ActiveX control not required
MFC class library, which is recommended by the author
Two methods.

III.


Package

ActiveX

Widget

Compiled
ActiveX control, we will
"
ActiveXDemo. ocx file generation. Next, open"
The PackageForTheWeb tool has the following interface:

Click "Next.

 

By default, click "Next.

 

Enter the above information. The "company name" and "Product Name" are mandatory. You can leave them blank. Click "Next.

 

  

  

Select"
Cab file, and click "Next.
  

  

  
  

Find the
ActiveXDemo. ocx directory, and click "Next.

  
  

 

Because we compiled
ActiveX control is compiled in the second method, so no additional
Dll file. If you want to attach other files, you can click the "add" button to customize the file to be added. Click "Next.

 


Click "OK" to add the default
INF file.

  

Click "Next.



Click "Next.



Set the project and
The directory where the cab file is saved. Click "Next.

  

  


Click "Next.



Click "finish.

4.


Release

ActiveX

Widget

Through the above steps, we will get a"
Activexdemo. cab file. We use"
Editplus
HTML file. The content is as follows:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Head>

<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>

<Title> ActiveX
Test
</Title>

<Script language = 'javascript '>

 

Function AddFun ()

{

Var iResult = MYAvtiveX. AddFun (12, 11 );//
Call
ActiveX
Control
AddFun
Method.

Alert (iResult );

}

</Script>

</Head>

 

<Body>

<Object id = "MYAvtiveX" classid = "clsid: F0E7128D-E311-42F1-A0BA-88397960732E"

CODEBASE ="
ActiveXDemo. cab # version = 1, 0, 1 "> </object>

<Fieldset>

<Legend> MyActiveX
Test
</Legend>

<Table width = "100%" border = "1">

<Tr>

<Td width = "20%"> <input type = 'button 'onclick = 'addfun () 'value = 'addfun'> </td>

</Tr>

</Table>

</Fieldset>

</Body>

</Html>

"
Version =, "must be consistent with the previous
In the Info file
Consistent version. So far, we can
Html page and
The cab file is placed in a directory and set
Web virtual directories can be tested in a browser.

5.


Update

ActiveX

Widget

If you modify
ActiveX control method, and use the above compilation method to compile
ActiveX control, packaging
ActiveX control. Package
In the ActiveX control step, we need to edit
In the INF file step, we can
FileVersion is set
1, 0, 0, 2. To distinguish previous versions.


We are updating
In the ActiveX control step
In the HTML file
<Object id = "MYAvtiveX" classid = "clsid: F0E7128D-E311-42F1-A0BA-88397960732E"

CODEBASE ="
ActiveXDemo. cab # version = 1, 0, 0, 2 "> </object>
Set
Set version to the version above. In this case, the client browser will automatically detect the version of the control when browsing the page. If there is an updated version, the browser will prompt you to reinstall the 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.