|
There are a few different ways to interface with and use
an ActiveX Control, such as using a test container, writing
a program that uses it, or using it on a web page.
Test Container
If you have Visual Studio, one of the available tools is
the ActiveX Control Test Container. This program allows you
to insert a control and invoke its methods, set the properties,
and see the events fired for each action.

In the screenshot above I have inserted an animated gif control
and it is playing an animated gif.
Writing a Program
ActiveX Controls can be easily used by any other program.
When writing a program you can add a control to your project
and use its public methods and fields. Using controls often
saves time and effort when writing a new program because it
allows you to reuse functionality. For example, using the
animated gif control mentioned above, I was able to quickly
and easily create an animated gif player.

Initialization
Some ActiveX Controls must be initialized before the Events
and Methods will be recognized by the Control, it is specific
to the Control as well as to the way the Control was written.
For example, the CD Control must have the property Command
set to the value of Open before any of the Events or Methods
assigned to the CD Control will fire. Because this Property
must be initialized for the ActiveX to work, a good place
to put the Set Property ScriptItem would be in the Event OnLoad
so that the Property is triggered as soon as the application
window is opened.
Walkthroughs:
Adding an ActiveX Control
in Visual C++ .NET
Adding an ActiveX Control in
Visual C++ 6.0
Adding an ActiveX Control in
Visual Basic 6.0
Adding an ActiveX Control
in Visual Studio .NET
Web Pages
A common use of ActiveX Controls is within web pages. Using
controls allows you to add much more functionality to a site.
For example, ActiveX Controls are commonly used by web servers
to interface with databases. Using an ActiveX Control on a
web page is very similar to using it within a program - you
can use its public methods and fields to performed desired
actions.
|