OLE Automation Server that Implements Collections SUMMARY ======= The LINES sample is an OLE Automation server application that implements collections. LINES allows a collection on lines to be drawn on a pane using OLE Automation. It exposes the following objects: Application object Properties Application FullName Name Pane (Returns the pane in the drawing window) Parent Visible Methods CreateLine (Returns a new Line object with no start point or endpoint) CreatePoint (Returns a new Point object initialized to (0,0)) Pane object Properties Lines (Returns a collection of all Line objects in the drawing) Points (Returns a collection of all Point objects in the drawing) MaxX (Returns the maximum visible X-coordinate value, in twips) MaxY (Returns the maximum visible Y-coordinate value, in twips) Methods Clear (Removes all Lines and Points from the drawing and refreshes the client area. It is as if the application had just started) Refresh (Clears the drawing and redraws each line in the collection) Line object Properties Color (An RGB color) EndPoint (A Point object indicating the endpoint for the line) StartPoint (A Point object indicating the start point for the line) Thickness (A thickness, in twips) Point object Properties x y Lines collection - Standard collection properties and methods. Objects that are added must be of type Line. - Objects returned are of type Line. - Add and Remove cause redrawing of the pane. - Adding a line causes two points to be added to the Points collection. - Removing a line can cause one or more points to be removed from the points collection. Points collection - Standard collection properties and methods. Objects returned are of type Point. - This collection does not allow addition and removal of members. - The Points collection does not have duplicates. If there are two lines in the drawing that share an endpoint (x, y), (x, y) appears in the collection only once. MORE INFORMATION ================ This sample implements the following features: - Dual interfaces that allow access to automation properties and methods through vtable binding and through IDispatch. - Rich Error information for vtable-binding controllers. This is done by implementing ISupportErrorInfo and using IErrorInfo. - Two collections. - Active object registration, using RegisterActiveObject and RevokeActiveObject. - Correct shutdown behavior. - A registry file that contains Lines.Application as progID. - Initial invisibility. To compile: ----------- 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 Also modify the .REG file to use 16 bit version of the keys. For example use LocalServer instead of LocalServer32. 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 To run: ------- Change LINES.REG to provide the full path of LINES.EXE and LINES.TLB. Register lines.reg in the registration database by double-clicking it. The VB 4.0 files vb.frm & vb.vbp in this directory will control the sample. Load vb.vbp into VB 4.0, reference the lines type library using VB's Tools/References menu and run. This will launch and control LINES. Files ------ LINES.ODL Object description language that describes the objects LINES exposes. TLB.H Header file generated by mktyplib.exe MAKEFILE Makefile for project. Other files implement the LINES automation server.