MFC: Using the VPE ActiveX with the MFC without placing it in a Dialog Resource

<< Click to Display Table of Contents >>

Navigation:  How To Use the VPE Control > VPE ActiveX >

MFC: Using the VPE ActiveX with the MFC without placing it in a Dialog Resource

Previous pageReturn to chapter overviewNext page

If you didn’t place the VPE ActiveX as Resource into a Dialog, you need to implement the COM licensing mechanism of Microsoft by yourself (see the according documentation from Microsoft).

In short:

Call CWnd::CreateControl() - in the last parameter you must specify the license key generated by the control. In order to get the generated key, you once need to create during development a project with the VPE ActiveX and call the methods:

lpU = CWnd::GetControlUnknown()

lpU -> QueryInterface(IID_IClassFactory2, &pClassFactory2)

pClassFactory2->RequestLicKey(NULL, pBstrKey)

pBstrKey will contain the generated key, which is the coded License Key.
Use this key in all other calls to CWnd::CreateControl() in your projects.

If you place the VPE ActiveX in VC++ as resource in a dialog you will have no problems and you don't need to get the key, etc. because VC does everything for you.#