SAMPLE: Marshaling Code for Connection Point Interfaces

ID: Q149231

The information in this article applies to:

SUMMARY

CXPRX provides 32-bit marshaling code for the IConnectionPoint, IConnectionPointContainer, IEnumConnections, and IEnumConnectionPoints interfaces. The next version of Windows and Windows NT will provide marshaling code for these interfaces, so be sure to follow the installation instructions specified below to prevent accidental overwriting of the system provided marshaling code.

The following file is available for download from the Microsoft Software Library:

 ~ CXPRX.exe (size: 108514 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

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

After downloading the file, run it in an empty directory with the -d switch to set up the directory structure:

   CXPRX.EXE -d

NOTE: The x86 directory contains a build of CXPRX.DLL that will work on Windows 95 and the Intel x86 version of Windows NT 3.51. The MIPS and Alpha directories contain builds of CXPRX.DLL for use on the MIPS and Alpha versions of Windows NT 3.51. This code will not work with 16-bit applications. Please do not modify the code or the version number. Change the CPU variable in the makefile to build for different platforms.

MORE INFORMATION

The connection point interfaces (IConnectionPoint, IConnectionPointContainer, IEnumConnections, and IEnumConnectionPoints) are used by components to implement event handling. These interfaces are documented in the OLE Controls documentation. Windows 95 and Windows NT 3.51 did not provide marshaling code for these interfaces. Consequently these interfaces could only be used with inproc objects on these platforms. The marshaling code provided here allows these interfaces to be used by out- of-process objects on the Windows NT 3.51 and Windows 95 platforms.

The next version of Windows and Windows NT will provide marshaling code for the connection point interfaces. To prevent the overwriting of this system provided marshaling code, it is important that you follow the following installation instructions when you install the marshaling code provided here:

Installation Instructions

An installation program that installs the marshaling code should follow these steps:

1. The installation program should check the system directory (determined

   at installation time by using the GetSystemDirectory() Win32 API) for
   the existence of CXPRX.DLL. If it exists and if the standard version-
   checking APIs indicate that it is a later version than the CXPRX.DLL
   provided by the installation program, it should not be overwritten and
   installation is complete. The version of CXPRX.DLL provided here is
   1,0,0,3 (See CXPRX.RC). If CXPRX.DLL exists in the system directory but
   if it is an earlier version, overwrite it and installation is complete.
   If CXPRX.DLL does not exist in the system directory, go to step 2.

2. The installation program should check for the existence of the following
   registry key to determine whether to continue installation or not:

      if (ERROR_SUCCESS != RegQueryValueEx(
      HKEY_CLASSES_ROOT,
      "Interface\\{B196B285-BAB4-101A-B69C-
       00AA00341D07}\\ProxyStubClsid32",
      NULL, REG_SZ, NULL, NULL))
      {
       ... go to step 3 ...
      }
      // else installation is complete;

   This check prevents accidental overwriting of the system's installed
   marshaling code when the system does provide marshaling of these
   interfaces in the future. So if this key is present, marshaling code for
   these interfaces exists and the installation is complete.

3. If installation gets past step 2, CXPRX.DLL should be copied to the
   system directory. Then the marshaling code must be registered in the
   registry by running REGSVR32.EXE CXPRX.DLL. REGSVR32.EXE will call the
   exported DllRegisterServer function in CXPRX.DLL to register the
   marshaling code. Installation is now complete.

Additional query words: kbOLE200 kbOLEArc kbSDKWin32 kbDSupport
Keywords          : kbfile
Platform          : NT WINDOWS
Issue type        : kbhowto

Last Reviewed: July 28, 1998