Deployment‎ > ‎

Avoiding COM (C++ only)

The good news is that you can use WordCaptureX without registering it as COM object and without reg free COM so it works on W2k too. 
 

The trick is to use the CreateCOMObject method exposed by our DLLs in order to get pointers to the COM interfaces. Here are the necessary steps:

  1.  You need to import the WCaptureX interface types in your application using the #import directive:
        #import "WCaptureX.dll" named_guids
      Optionally, you can add:
        using namespace WCaptureXLib;
    to avoid writing "WCaptureXLib::" each time you use a type name from our interfaces.

  2.  Load the WCAPTUREX.DLL library and call the CreateCOMObject function:
         typedef HRESULT (__stdcall *CreateCOMObjectPROC)(REFCLSID, REFIID, LPVOID*);
      HMODULE mod = LoadLibrary("wcapturex.dll");
      CreateCOMObjectPROC _CreateCOMObject = (CreateCOMObjectPROC)GetProcAddress(mod,
                                                 "CreateCOMObject");
      CComPtr<IWCaptureX>    wcapt;
      HRESULT res = _CreateCOMObject(CLSID_WCaptureX, IID_IWCaptureX, (LPVOID*)&wcapt);
    
The code above is a sample, you can adapt it to your needs.

Other types can be obtained from the WCAPTUREX.TLH file that is generated by the compiler after the first #import at    compilation time. The TLH file can be found in the "Intermediate Directory" of the Visual Studio project.
 



Comments