How to use HexGadgets
HexGadgetsTM can be used with a wide range of software development
tools--from Excel macros to Visual C++. They provide dual interfaces (custom and
IDispatch), thus supporting both early and late binding.
The primary HexGadget ProgIDs are as follows:
- Hexillion.HexIcmp
- Hexillion.HexLookup
- Hexillion.HexTcpQuery
- HexDns.Connection
- HexValidEmail.Connection
Here are details on using HexGadgets with several specific tools:
Active Server Pages
The easiest way to create a component instance in ASP is to use the Server.CreateObject
method. Here's a VBScript example:
dim obj
set obj = Server.CreateObject( "Hexillion.HexIcmp" )
Response.Write obj.Version
JScript looks much the same:
var obj = Server.CreateObject( "Hexillion.HexIcmp" );
Response.Write( obj.Version );
Visual Basic
With Visual Basic 5.0 and later, you will most likely want to use early binding. Simply
choose References from the Project menu and select the Hexillion components from the list.
This causes VB to read the components' type libraries and thereby provide predefined
constants, syntax prompting, and, of course, early binding capabilities. You will be able
to write code like the following:
Dim oTcpq As HexTcpQuery
Set oTcpq = New HexTcpQuery
oTcpq.RemotePort = hexTcpqPortHttp
If you have VB4 or want to use late binding, you can write the same code this way:
Const portHttp As Integer = 80
Dim oTcpq As Object
Set oTcpq = CreateObject( "Hexillion.HexTcpQuery" )
oTcpq.RemotePort = portHttp
Visual C++
If you have Visual C++ 5.0 or later, simply use the #import
directive. This automagically creates wrapper classes and enumerations. There are two
things to point out, however:
#import places the wrapper classes in
namespaces named for the type libraries from which they were derived. Thus, you will need
to explicitly refer to the proper namespace ("HexTcpQueryLib::hexTcpqPortHttp")
or put a using namespace statement at the
top of your source file.
- You will have to refer to the component interfaces by their actual interface names. (VB
and other RAD tools tend to obscure the distinction between classes and interfaces.) The
interface names start with "I" and end with "Sync", as the interfaces
are currently synchronous. For instance, HexIcmp's primary interface is IHexIcmpSync.
See the HexIcmp examples for a complete Visual C++
usage example.
|