HOWTO: Create an OLE Server to Implement "Thunking"Last reviewed: January 21, 1998Article ID: Q141939 |
The information in this article applies to:
SUMMARYAn out-of-process OLE server (that is, an EXE) may be called by either a 16- bit or 32-bit program. Hence, it can be used as an interface between a 16- bit program that requires the services of a 32-bit DLL, or a 32-bit program that calls functions inside a 16-bit application/DLL. This permits the OLE system DLLs to handle any necessary "thunking" of the 16-bit to 32-bit or 32-bit to 16-bit translations. This article demonstrates how the functions contained in a 16-bit DLL can be called from a 32-bit program using an OLE server as an intermediary.
MORE INFORMATIONA key goal of OLE is to establish a standardized way for objects to be created and to communicate with one another. This communication can take place between applications even if they are written in different languages. Because OLE defines the interface, it handles the communication between the two objects. Please see the REFERENCES section below for more details. In particular, one useful corollary of the standardized interface that OLE demands is that an out-of-process OLE server can act as an intermediary to perform the "thunking" required if a 32-bit application needs to call a function contained in a 16-bit DLL and vice versa.
Example: A 32-Bit Program Calling a 16-Bit DLLThis example creates a 16-bit OLE server to wrap the functions contained in a 16-bit DLL. In this example, the Mbf2ieee.dll is used. You must have this DLL in order to be able to complete this example. This DLL converts floating point numbers in the earlier Microsoft Binary Format (MBF) into IEEE format. For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q113439 TITLE : VB3PRB: Converting MBF to IEEE in Visual Basic for WindowsThe file can be downloaded from the Microsoft Software Library as Mbf2ieee.exe. This DLL is an example of a 16-bit DLL that is difficult to update to 32-bit because the DLL calls two C run-time functions that have not been ported over to 32-bit. Use the steps below to create the OLE server:
REFERENCES"Microsoft OLE Today and Tomorrow: Technology Overview," created December, 1993. Found under Backgrounders and White Papers, Operating System Extensions, Microsoft Developer Network CD-ROM. For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q140520 TITLE : PRB: Converting MBF to IEEE in Visual Basic for Windows Keywords : IAPOLE VB4ALL VB4WIN kbhowto Technology : kbole Version : 4.0 Platform : NT WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |