Programming Considerations

Before invoking an OLE method, you must establish a connection to the automation server’s exported object interfaces (for more information on the IDispatch object interface, we recommend the book Inside OLE, Second Edition, by Kraig Brockschmidt). You call the server’s OLE methods by invoking the same methods on an object on the client side of the OLE connection. When you’re finished calling methods, you detach your local object from its connection with the OLE automation server. Most applications want to minimize the amount of time they maintain an open OLE connection, because a user can close the FrontPage application or change its state in ways that will cause the automation operation to fail. Typically, you will open and close the OLE connection inside a single function.