OLE Automation Controller and Server that Browses a Type Library
SUMMARY
=======
The BROWSE sample controls the automation objects of the BROWSEH (Browse
Helper) inproc server to browse a type library. BROWSE is a developer-
oriented type library browser.
In addition to displaying type library information, this sample shows how
to control an automation object by accessing its properties and methods.
BROWSE provides generic helper functions (CreateObject & Invoke) to control
any automation server. For more information on how to use these functions,
see the comments in INVHELP.CPP.
BROWSEH exposes a number of automation objects that correspond to
components of a type library. This allows an automation controller like
BROWSE to access the properties and methods of these objects to browse the
type library instead of directly using ITypeLib and ITypeInfo. So BROWSEH
is a type library browse helper. BROWSEH does not support vtable binding.
Controllers must use IDispatch to control this server.
MORE INFORMATION
================
The following information describes the BROWSE sample.
To Compile BROWSE and BROWSEH
-----------------------------
To compile an ANSI debug version of the sample for Windows NT and Windows 95,
use the following command:
nmake
To compile a Unicode debug version of the sample for Windows NT only, use the
following command:
nmake dev=win32 HOST=NT
To compile a 16-bit debug version of the sample and if your development
environment is Win 3.x, use the following command. If your development
environment is Win95 or NT, change the HOST appropriately.
nmake dev=win16 HOST=DOS
To clean up between builds which use different options, use one of the
following commands:
nmake clean
nmake dev=win16 clean
See the makefile header comments for other make options.
If one of the build tools cannot find SDKUTIL.LIB, use the SAMPLES\COM\COMMON
sample to build SDKUTIL.LIB.
Visual C++ 2.x and above can use makefile as an external makefile
after making the following replacement in the makefile:
!include <$(MSTOOLS)\samples\com\include\olesampl.mak>
with
!include <win32.mak>
To Run BROWSE
-------------
- Change BROWSEH.REG to provide the full path of BROWSEH.DLL, BROWSEH.TLB and MYDISP.TLB.
- Register BROWSEH.REG in the registration database by double-clicking it.
- Run BROWSE.EXE and use the menu to select a type library to browse.
BROWSE Files
------------
INVHELP.CPP and INVHELP.H contain two helper functions that are used to
create an automation object (using CreateObject) and to invoke a method
or property of that object (using Invoke). These functions are general
enough to be used by any Automation controller.
BROWSE.CPP uses the helper functions in invhelp.cpp to access the
properties and methods of the automation objects of BROWSEH.
MAKEFILE is the makefile for the project.
To run BROWSEH
--------------
- Change BROWSEH.REG to provide the full path of BROWSEH.DLL and BROWSEH.TLB.
- Register BROWSEH.REG in the registration database by double-clicking it.
- Run the Automation controller BROWSE that uses BROWSEH to browse a type
library OR load and run the VB 4.0 VB.VBP project file which uses BROWSEH
to output a C/C++ header file from the infromation in a type library. The
header file can be used to create a C/C++ vtbl-binding client for the server
to which the type library belongs, if the server supports vtbl-binding. After
running the VB script, select the type library to be used as the input and
specify the name of the header file to be output.
BROWSEH Files
-------------
MYDISP.ODL contains the description of a base class that implements
IDispatch. All automation objects in this server are derived from this
class. This is the implementation of IDispatch in the base class to be
inherited in the derived classes.
BROWSEH.ODL contains the description of the objects that BROWSEH exposes.
TLB.H is the header file generated by mktyplib.exe
MAKEFILE is the makefile for project.
MAIN.CPP contains code to create an inproc server.
Other files implement the BROWSEH automation server. For example,
COCLASS.CPP demonstrates how to use ITypeInfo and ITypeLib to browse a
coclass in a type library.
VB.VBP and VB.FRM are VB 4.0 files that uses BROWSEH to browse a type library
and to create a C/C++ header file from the browsed information.