Search   |  About Us  |  Contact Us   |  Portfolio 

Leading your developers forward







Home

Programming

Web 
Development

E-Commerce

Web Services

Consulting

Mentoring

Training

Books &
Writing

 

 

 

ActiveX Page

An ActiveX control is what used to be called an OLE control or OCX control, with some modifications to take advantage of the Internet. If you have some OCX controls on your system today, you can embed them in a Web page without changing them at all. However the real fun is in writing new controls that are designed especially for Web pages, to activate them and let the user really do things, not just read text and look at pictures.

Sure, there are other ways to make pages active. CGI scripts, for example. They run on the server, and have to gather information from you or your web browser, process it on the server, then send back the results. If the server is slow, the process is slow. If the communications link to the server is slow or heavily loaded, the process is slow. ActiveX controls run on your machine, so there's no communication lag. ISAPI extensions are also powerful, but they too run on the server, and not all servers support them. JavaScript runs on your desktop, but the script has to be loaded from the server each time before it is run. The same is (usually) true for Java applets. ActiveX controls are downloaded and registered once, then stay on the client machine for the next time the client comes to this site. You might also consider an Active Server Page component, which runs on the server. On this site we've developed:

If it worries you a little that someone else has written a program that will automatically download and run on your desktop, it should. There is a real security risk. As a matter of fact, ActiveX has no security whatsoever. There are several approaches to dealing with this risk. One is to prevent the language from doing certain things (writing to the file system, for example) so that even malicious people cannot write code that causes harm. This is the Java approach, but there are many examples already of Java security holes, and in addition there are things you cannot implement in Java because of this restriction. (We've made a Java version of this dieroll, but it cannot fire events.) A second approach is to refuse to download and run software unless you know for sure who made it, and how to reach them if there's a problem. Code signing, as implemented in ActiveX controls, gives you this assurance. Third party companies "sign" controls and assure you that they were created by specific developers. Those developers have to give the third parties verifiable information (like a postal address) before the code is signed. This is parallel to the situation that exists today when buying shrink-wrapped software. If the software causes damage to your system, you know who to turn to with your complaint.

Before you load the sample page

This sample is an ActiveX control with asynchronous properties, written with MFC. These pages demonstrate the control, and show how an ActiveX control can interact with JavaScript.

This sample is an improvement over the one presented in Using Visual C++ 4.2, published in October 1996. (The changes are summarized on the changes page.) The code is not signed, so in Explorer your Active Content Safety Level will have to be on None or Medium. On Medium you will be prompted about loading this unsigned control. To change the level, choose View, Options and click the Security tab. Enable "Allow downloading of active content", "Enable ActiveX controls and plug-ins", and "Run ActiveX scripts" and choose your safety level. We recommend Medium. 

Best experienced with

Click here to start.
In order to view the sample page properly you will need either Microsoft Internet Explorer 3.0 or Netscape Navigator 3.0 with NCompass Labs' ScriptActive plug-in installed.
When you load the Dieroll Sample PageOne Die, it will check to see if you have the dieroll ActiveX control already installed. If not, the control will be downloaded and installed on your machine. It will also check to see if you have the latest MSVCRT.DLL (version 4.20.0.6164) MFC42.DLL (version 4.2.0.6256) and OLEPRO32.DLL (version 4.2.0.6068). They are all loaded from Microsoft's site in a signed cab file. This file is 717,450 bytes long so it can take 5 or10 minutes to load. (This is a one-time thing, once you have the DLLs you will not have to download them again.) The install program for the MFC DLLs may ask you to reboot. For more information on Microsoft's cab file of the MFC DLLs, visit their page.Note: If you are using Netscape Navigator to view the page, the ScriptActive plug-in may try to load the control and the DLL twice. If so, you can tell it not to load the second copy, then the second die will fail to load, but you can press reload and since the control is now loaded and registered, both dice will show up.

Other Resources

Here is a list of other resources related to ActiveX controls, JavaScript and Visual C++.

 

Copyright Gregory Consulting Limited 1996-2004. All rights reserved.