Establishing a Connection to the ToolTalk Service

Creating an instance of the VkMsgApp class opens a ToolTalk connection and sets up all resources needed to send and receive ToolTalk messages. Remember to use the VkMsgApp class in your application instead of a VkApp object if you want ToolTalk support for your application. The syntax of the VkMsgApp constructor is:

VkMsgApp(char* appClassName, int* argc, char** argv,
XrmOptionDescRec* optionList = NULL,
int sizeOfOptionList = 0,
const char* ptid = NULL,
const char* sessid = NULL
Boolean noProtocol = FALSE)

The first five arguments are the same as those that you can provide to the VkApp constructor. The ptid argument specifies a process type. It defaults to NULL which indicates no process type. You need to provide a ptid argument only if this application is autostarted (see "Registering Services for Autostart" ). sessid specifies a session to join. If you don't provide a value, the process joins the default session.

The noProtocol argument determines whether your application automatically provides support for handling "Lower," "Raise," and "Quit" messages. If this value is FALSE (the default), your application calls VkApp::iconify() upon receiving a "Lower" message, VkApp::open() and VkApp::raise() upon receiving a "Raise" message, and VkApp::quitYourself() upon receiving a "Quit" message.

Command line arguments

You can also specify the session using command line arguments when you invoke your applications:

-project sessid Join the session specified by sessid

-projectWindow windowid Join the same session as the window specified by windowid

-projectWindow Allow the user to click on a window and join the same session as the window specified

The VkMsgApp class also creates an instance of VkMsgClient that you can use to manage messages in your application. You can retrieve a pointer to this object with the VkMsgApp::messageClient() function:

VkMsgClient* messageClient()