Send Message Server

This is a simple sample Automation server and client. This sample implements a custom interface using the Automation marshaller. The Automation marshaller is not described much in the Microsoft documentation and articles but can be very useful. The only documentation I am aware of are:

The VTBLBIND sample server and client are very useful and the only significant advantage that my samples have is that my samples do less and therefore are simpler, but the VTBLBIND samples are more useful for a final product.

The following is the source code.

ISendMessage.idl Interface definition
SendMessage.cpp The server
SendMessage.reg Registration file
SendMessageClient.cpp Sample client.
The easiest way to save these files as source/text files (using Internet Explorer) is to either:
  • right-click it and "Save Target As"
  • while viewing it, "View Source"

Since this server has a type library, it can be called by Visual Basic. Add a reference to the ISendMessage.tlb file that is generated from the ISendMessage.idl file when the server project is built. Then the following code will call the server, but the server must be executing for it to work and each time the server is used in this manner requires a new execution of the server.

	Dim Message As New CSendMessage
Message.Send "Message"

See my Visual C++ Programmer Stuff page for more C++ stuff.