Discuss this help topic in MsgConnect Forum

Filter: C++  Pascal  C#  VB.NET  Java  Java ME  ActiveX  DLL 



MMFTransport.MessengerName

MMFTransport     See also    


Specifies the name of the memory mapping used to receive messages.

Declaration

[C++]
    void setMessengerName(char* Value);
    char* getName();

[Pascal]
    property MessengerName : string;

[VB6]
    Property MessengerName As String

[ActiveX]
    BSTR MessengerName;

[C#]
    public string MessengerName;

[VB.NET]
    Public Property MessengerName As String

[Java]
    public void setMessengerName(string value);
    public string getMessengerName();

[Java ME]
    not applicable;

[DLL]
    void __stdcall MCMMFTransportSetMessengerName(HMCMMFTransport h, char* value);
    char* __stdcall MCMMFTransportGetMessengerName(HMCMMFTransport h);

Parameters

  • h - handle to the object that was returned by Create method

Description

    This property specifies the name for the memory mapping. The name is used as a destination address for the sender -- the sender should specify this name in the address of the message. See more in Addressing topic.
The value of this property should be compatible with CreateFileMapping WinAPI function. Be sure to use unique names for all kernel objects in your system.

You must remember about namespaces, if you are using MMF transport on any Windows version starting with XP SP2 and later.

    The service application should specify the name as "Global\MessengerNameValue".
    Regular user-mode application should include "Session" prefix followed by session ID, e.g. "Session\#\MessengerNameValue", where # is the ID of the user session.

    To obtain the ID of the session in which your process is running, you need to

  1. call GetCurrentProcessId to obtain ID of the current process
  2. get session ID by calling ProcessIdToSessionId API function. This function is exported by kernel32.dll and is implemented in Windows 2000 and above.

    The following information applies when you need to compose the address to send the message to another application.
Use ProcessIdToSessionID function to find the session ID of the destinaion process. To get the process ID of the destination process you need to search for the process by name (use CreateToolhelp32Snapshot() Windows API function to enumerate processes and get their names). If your destination process is a service, you can use an alternative (easier way) to get the process ID: use OpenService to get the service handle, then use QueryServiceStatusEx() function to obtain the service status information which includes process ID.

See also:     Addressing    

Discuss this help topic in MsgConnect Forum