XYSystem Components Help

[Copyright]
[Table of Contents]

Using XYMessenger.ocx within a console application

XYMessenger.ocx is an ActiveX control.  It can be used within a console application with the help of the C++ class XYDispDriver.  This class is a general tool for C++ programmers which can be used to create any windowless com object (the com interface has to be derived from IDispatch, however).  All you have to do is call CreateObject to instantiate an instance of your com object, and then call InvokeMethod to invoke its methods.  The details are described in one of my articles.

Handling XYMessenger.ocx events

Typically, it is not easy to handle com events within a console application.   However, handling events of XYMessenger.ocx is easy.  Again, XYDispDriver is the main tool that makes this possible.  Please refer to another article of mine for the basic ideas.

Here is a sample program demonstrating the use of XYMessenger.ocx.  This program is a simple console application that uses XYMessenger.ocx as the root server.  Other client programs such as XYTreeDemo.exe can connect to this server.  All XYMessenger events are handled in this program.  You can easily write your own console application that uses XYMessenger.ocx by copying and pasting code from this sample.

By the way, you need to register the XYEventHandler.ocx control before running this sample program.  The source code of XYEventHandler.ocx is included in the XYSystem sample code package.

[Table of Contents]