PXС_Inst ActiveX Object

From Tracker Software PDF SDK
Revision as of 18:35, 1 June 2015 by Pifagor (Talk | contribs) (Created page with "__NOTOC__ Category:Editor {{#customTitle:PXС_Inst ActiveX Object}} {{#parentPage:PXV:PXV_CoClasses|PXС_Inst|interface}} {{ToReview}} == Overview == The main ActiveX Ob...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Overview

The main ActiveX Object of PDF-XChange Core API SDK that provides part of general functionality to work with PDF and gives access to an additional extensions of SDK.

The GUID of object is:

{D37FFAC6-B7ED-441E-B933-19B4E57FCB60}

The interface of control is:

IPXC_Inst

How to Instantiate

You may instantiate the object in standard way by using the CoCreateInstance function or by any other method that is appropriate for instantiating of regular ActiveX-objects in your programming language.

For example, in C#:

AxPDFXCoreAPI.AxPXC_Inst pdfInst = new AxPDFXCoreAPI.AxPXC_Inst();

In VB6:

Dim pdfInst As PDFXCoreAPI.PXC_Inst
...    
Set pdfInst = New PDFXCoreAPI.PXC_Inst

In C++:

CComPtr<IPXC_Inst> spPDFInst;
HRESULT hr = CoCreateInstance(__uuidof(PXC_Inst), nullptr, CLSCTX_INPROC_SERVER, __uuidof(IPXC_Inst), (void**)&spPDFInst);

Also, exists other special way to get pointer to IPXC_Inst interface. For example, in C++:

typedef HRESULT (__cdecl *t_pPXC_GetInstance)(IPXC_Inst** ppInst);

#if defined _M_IX86
#define SDK_LIB_NAME	L"PDFXCoreAPI.x86.DLL"
#else
#define SDK_LIB_NAME	L"PDFXCoreAPI.x64.DLL"
#endif

CComPtr<IPXC_Inst> spPDFInst;
HMODULE hSDKLib = LoadLibrary(SDK_LIB_NAME);
t_pPXC_GetInstance pfn = (t_pPXC_GetInstance)GetProcAddress(hSDKLib, "PXC_GetInstance");
HRESULT hr = pfn(&spPDFInst);

- with this special method you will be able to use SDK without regular installation as COM-server on client machine.

NOTE: in context of PDF-XChange Editor SDK this object has different GUID:

{77E64401-E3E8-4049-A630-0434E69586AA}

and you have only two ways to get access to it:

  • A. By using CoCreateInstance. For example, in C#:
AxPDFXEdit.AxPXC_Inst pdfCoreInst = AxPDFXEdit.AxPXC_Inst();
  • B. By getting pointer to IPXC_Inst interface as extension. For example, in C++:
AxPDFXEdit.AxPXV_Inst pdfInst;
...
AxPDFXEdit.AxPXC_Inst pdfCoreInst = (AxPDFXEdit.AxPXC_Inst)pdfInst.GetExtension("PXC");


How to Use

Firstly you need call IPXV_Inst::Init function before any use of the SDK. But, if you've created a PXV_Control object before, you may not call this function, because it has already been done through the creating of PXV_Control-object. Another important point: when you finishing work with the SDK, you should call IPXV_Inst::Shutdown method to release all used resources, to stop correctly all working threads, etc. But, if IPXV_Inst::Init method had not been called directly and only simple PXV_Control was used, then you may not call it. Also, in conclusion, the IPXV_Inst::Shutdown method should be called the same number of times as IPXV_Inst::Init was called.