|
SendMSG Function
Description
Sending the Data to the other process
Definition
Public Function SendMSG( _ ByVal MSGData As String _ ByVal [ToName] As String _ ByVal [ToExactName] As String _ ) As Boolean
Parameters
MSGData
The data for sending
[ToName]
The name of recipient application
[ToExactName]
The exact name of recipient application
Remarks
ComTL allows developer to create more than one instance of ComTL with same AppName, because some times it is necessary to run the same program more than once. In this case is recommended to use the ExactName for sending data. But if there are more than one applications running with the same name and third application trying to sent to one of them message using the Name (and not ExactName) parameter, ComTL will display a dialog of multi-instance application and the end user will be able to choose the target of data. (see screenshot below). Therefore it is recommended to use the ExactName instead of Name. ExactName could be retrieved from WhoAmI function or from the XML Header when properties SendAsXML and IncludeHeader are both true.

Screenshot of Multi-Instance appeariance of ComTL with same name
How It Works
When ComTL is Initialize, three parameteris are passed to it. The second parameter is a Name. This name could be used by developer as an address for sending data. At this time ComTL generates a uniqe name for that instant it is a ExactName. ExactName is a combination of given by developer Name, underscore and system wide uniqe ID. looks like name_id. For example if the name is VB the ExactName will be VB_123456 when _123456 generated and added by ComTL. Developer could using the name he set, but when there are more than one applications with ComTL named VB running, using ExactName is recommended to deliver a data.
Example
The following code demonstrate sending data using the Name and the ExactName parameters
Private Sub SendData(ByVal sDataToSend As String, ByVal sName As String, ByVal Optional sExactName As String) Dim ret As Boolean If sExactName <> "" Then
ret = ComTL.SendMSG(sDataToSend, , sExactName) Else ret = ComTL.SendMSG(sDataToSend, sName) End If If Not ret Then 'some error occurred End If End Sub
|