SAMPLE: Multilingual OLE Automation Object

Last reviewed: June 3, 1996
Article ID: Q107698
The information in this article applies to:
  • Microsoft OLE Libraries for Windows and Win32s, version 2.0
  • Microsoft OLE Libraries, included with:

        - Microsoft Windows NT, versions 3.5 and 3.51
        - Microsoft Windows 95
    

SUMMARY

MULTLING demonstrates how to create an OLE automation object that supports multiple languages. This allows the controller of an automation object to access properties and methods using any of the languages that are supported.

You can find MULTLING.EXE (size: 29766 bytes) 
                         , a self-extracting file, on these services:

  • Microsoft's World Wide Web site on the Internet

          On the www.microsoft.com home page, click the Support icon
          Click Knowledge Base, and select the product
    
          Enter kbfile MULTLING.EXE (size: 29766 bytes) 
                                   , and click GO!
          Open the article, and click the button to download the file
    
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the Softlib/Mslfiles folder
          Get MULTLING.EXE (size: 29766 bytes) 
    
  • The Microsoft Network

          On the Edit menu, click Go To, and then click Other Location
          Type "mssupport" (without the quotation marks)
          Double-click the MS Software Library icon
          Find the appropriate product area
          Locate and Download MULTLING.EXE
    
  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download MULTLING.EXE (size: 29766 bytes) 
    

    For additional information about downloading, please see the following article in the Microsoft Knowledge Base:

       ARTICLE-ID: Q119591
       TITLE     : How to Obtain Microsoft Support Files from Online Services
    
    
    

    MORE INFORMATION

    This multilingual OLE automation object sample checks the Locale ID (LCID) passed methods of the IDispatch interface to determine the language being used by the automation controller. The object supports access of properties and methods in English, French, and German.

    One Type Library Per Language

    The automation object registers three different type libraries in the registration database--one for each supported language. The type libraries have the same UUIDs but different locale attributes. Each type library is loaded at object creation and the ITypeInfo interface is obtained from each as follows (see LoadTypeInfo in MAIN.CPP):

       LoadRegTypeLib(LIBID_Hello, 1, 0, lcid, &ptlib);
       ptlib->GetTypeInfoOfGuid(IID_IHello, &ptinfo);
    
    
    Also see ENGLISH.ODL, FRENCH.ODL, GERMAN.ODL, and HELLO.REG.

    Interpret LCID in IDispatch Methods

    The implementation of IDispatch::GetTypeInfo, GetIDsOfNames, and Invoke checks the value of the lcid parameter to determine the locale ID and uses the appropriate ITypeInfo for that language (See CHello::GetTypeInfo, GetIDsOfNames, and Invoke in HELLO.CPP).

    To Run

    The multilingual automation object exposes one VT_BSTR property (HelloMessage) and one method (SayHello).

    ProgID                  :  HelloMultiLingual.Hello
    
    
    Method and Property Names:

    English         French         German          Action
    

    HelloMessage    SalutMessage   HalloNachricht  Sets or gets the
                                                   HelloMessage string.
    SayHello        DitSalut       SagHallo        Displays the HelloMessage
                                                   in an edit control.
    
    
    Use the AUTOCTRL sample to control the multilingual automation object. The AUTOCTRL automation controller allows the locale ID to be specified.

    Update the path in HELLO.REG to the current location of the object and the type libraries.

    To Compile

    Requires OLE 2.01 or later.

    Include device=vmb.386 in the [386Enh] section of SYSTEM.INI. Note that vmb.386 can be found in \OLE2\BIN. Run the WXSERVER.EXE from \OLE2\BIN before running the makefile.


  • Additional reference words: 2.00 3.50 4.00 multi-lingual softlib
    MULTLING.EXE
    KBCategory: kbole kbfile
    KBSubcategory: LeTwoAto


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: June 3, 1996
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.