COM Wrapper Example |
Sometimes, you may find it necessary to build a COM wrapper for a third-party application/library, particularly if you want to subscribe to an event from a third-party application/library. A COM wrapper is simply a COM interface built around the third-party application/library.
The best way to understand how to build a COM wrapper is to look at an example. For this purpose, PVX Plus Technologies has created a simple application/library and a COM wrapper, as well as a PxPlus object for handling the COM event and a PxPlus program for testing. This example demonstrates how to build a COM wrapper and subsequently use it to have PxPlus subscribe to a third-party application/library event.
The components that were created for this example can be downloaded as a ZIP archive using this link: SimpleCOM.zip.
The SimpleCOM.zip archive consists of the following:
SimpleCOM Visual Studio Solution |
This solution contains the two projects listed below and can be used to build both of them.
| ||||
SimpleCOMEvents PxPlus Class Code |
This was generated using the PVXTLB.EXE application on the SimpleCOM interface. The generated code was then modified to display to the screen that the click event was received. | ||||
SimpleCOMTest PxPlus Program |
Run this program to instantiate the SimpleCOM object and subscribe to the click event. |
For this example, comments have been inserted in the code, so you may find it very helpful to review the code to gain a better understanding of how to build a COM wrapper.
As you go through this example, keep the following points in mind:
(This COM Wrapper example was added in PxPlus 2016.)