How to Automatically Update an ActiveX Control
Software Update Channels enable users to receive automatic updates of Microsoft ActiveX Controls. All a user must do is download an ActiveX control from your site and subscribe to your Software Update Channel. When you release new versions of your ActiveX control, subscribed users visiting a site that uses the new version can choose to receive the update automatically. The new version can be installed immediately, or precached for offline installation later.
This article applies to ActiveX Controls, not applications or Java applets. For information about updating applications, see Publishing Application Updates on the Web.
Support for Software Update Channels and Channel Definition Format (CDF) files began with Microsoft Internet Explorer 4.0.
To enable users to automatically install updated versions of ActiveX Controls, perform the following tasks:
- Create an \osd\GenericSample share off the root directory of your Web server. If you are using the Personal Web Server on your local computer, create a directory (\osd) under the \Webshare\Wwwroot directory and then create a subdirectory (\GenericSample) under the \osd directory.
- Copy the contents of the Open Software Description sample into your share.
- Update the HREF attribute of the CHANNEL element in Circ3_orig.cdf, Circ3_adv.cdf, and Circ3_pc.cdf by replacing <your server> with the name of your server.
- Copy the updated version of Circ3_orig.cdf as Circ3.cdf into your share.
- Open Internet Explorer 4.0 or later and browse to Circ3.htm. This will install the first version of the Circle ActiveX control (build 1).
Subscribe to Circ3.cdf by clicking the Add Active Channel logo, as shown in the following image.
- If you are subscribing a user to an automatic subscription, it is important to obtain the user's consent first.
- Users can click Customize to configure Internet Explorer to either send an e-mail notification upon new software availability, or choose a custom schedule to tell Internet Explorer when to check for new software. You can define schedules in the CDF file with the SCHEDULE element under the CHANNEL element.
- Because the value of the USAGE element in the Circ3.cdf file is set to "SoftwareUpdate," the channel will be displayed in Internet Explorer under the Favorites/Software Updates folder.
Now assume you have a new build, build 2 of your control, ready to roll out. You want all users who have build 1 to automatically update to build 2 as soon as they hit any page that uses the Circle control.
Copy Circ3_pc.cdf on top of Circ3.cdf. (You can use Circ3_adv.cdf instead of Circ3_pc.cdf if you don't want to automatically preload the user's cache with the new build. Precache does not mean autoinstall; Internet Explorer just caches the new build so the user can later install the control faster and even while offline). The new CDF file advertises build 2 of the Circle control.Note To run this demonstration again, you must copy Circ3_orig.cdf back on top of Circ3.cdf. You will also have to copy Circ3_v1.cab on top of Circ3.cab.
- Copy Circ3_v2.cab on top of Circ3.cab. This is exactly the same as the real-life situation where the user sees only Circ3.cab but you have Circ3_v1.cab (version 1) and Circ3_v2.cab (version 2). When you update to version 2, you don't want version 1 to be available anymore, so you copy Circ3_v2.cab over Circ3.cab, the external distribution cabinet file.
- On the client computer, first make sure that the zone you are in is set for Custom. Under ActiveX Controls And Plugins/Download Unsigned ActiveX Controls, select Enable. Note that this is needed only for the demonstration file because the cabinet files are not signed; if they were signed, this would not be needed. Then select Favorites/Update All Subscriptions, or right-click the Circle channel (under Favorites/Software Updates) and select Update Now. Note that if the CDF file had defined an automatic schedule, this update would have happened automatically like any other subscription in Internet Explorer.
- The Circle channel icon will gleam (red gleam on the upper-left corner of the icon). If you set up the e-mail notification during subscription, you will receive e-mail notifying you of the updated software. When you click the Circle channel, Internet Explorer will navigate to the home page of the channel. This page has instructions on how to download/install the new version of Circle (in this case just a link to an HTML page with the object element for the new version of Circle).
- Alternately, if you return to view Circ3.htm (or any page that uses build 1 of the Circle ActiveX control), the client will be automatically upgraded to version 2 because Internet Explorer knows that build 2 is available. In this simple example, note that the only way to see the version difference between the two Circle controls is to view the properties on the Circle control in the Downloaded Program Files directory.