[CONNECT Update 16] GetStringFromMstnResource

I notice that the .NET Session class has member GetStringFromMstnResource.  It looks like that function gets a string from a message list stored in a .rsc file, which is what we've done for MDL and C++ apps for donkey's years. 

In a .NET AddIn, how is that .rsc file connected to the code?  With the MicroStationAPI, we build an app that merges resources (messages, dialogs etc) into the app.ma file.  But a .NET AddIn doesn't have a permanent .ma file.  How does a .rsc file work with a .NET AddIn build?

Parents
  • Hi ,

    Its primarily there for interoperability between .NET managed and native code MDL applications.

    Where you would want to call GetStringFromMstnResource from a managed code .NET application for the ability to obtain a .NET String instance populated from an existing (localized) native code MDL message/string resource (primarily .rsc files, or .ma, etc.) w/o need to duplicate those resource strings multiple times using different conventions for each target language and every native and managed code application instance created.

    The first parameter is the MessageList/StringList ID and the second parameter is the Resource ID (index) of the message string you wish to access; similar to this example:

    String levelOutput = Session.GetStringFromMstnResource (MstnMessageListNumber.Messages2, 911);
    ...
    sOutput = String.Format ("({0}) {1}", styleNo.ToString(), levelOutput);

    HTH,
    Bob



  • Where you would want to call GetStringFromMstnResource from a managed code .NET application for the ability to obtain a .NET String instance populated from an existing native code MDL message/string resource (primarily .rsc files, or .ma, etc.)

    OK, so it's not the intention to somehow bundle a .rsc file with a .NET AddIn?

    If I want to use an existing .rsc or .ma file from .NET, how do I go about opening that file so that GetStringFromMstnResource can read it?  Besides opening the file, some other part of the API must register the message list IDs to that a call to GetStringFromMstnResource can resolve the message ID and the message list ID.  You mention the MstnMessageListNumber,  but MicroStationAPI help doesn't go any further than to acknowledge its existence.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Where you would want to call GetStringFromMstnResource from a managed code .NET application for the ability to obtain a .NET String instance populated from an existing native code MDL message/string resource (primarily .rsc files, or .ma, etc.)

    OK, so it's not the intention to somehow bundle a .rsc file with a .NET AddIn?

    If I want to use an existing .rsc or .ma file from .NET, how do I go about opening that file so that GetStringFromMstnResource can read it?  Besides opening the file, some other part of the API must register the message list IDs to that a call to GetStringFromMstnResource can resolve the message ID and the message list ID.  You mention the MstnMessageListNumber,  but MicroStationAPI help doesn't go any further than to acknowledge its existence.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data