How to pass a runtime license key to CreateControl()

W

wschneider

Hi

I have a problem with passing a runtime license key for an ActiveX
control to the method CreateControl() of the class
pywin.mfc.activex.Control.

Can anybody give me a hint in which form the license key string must be
passed to this method?

I got the license key for the ActiveX control using the "License Key
Requester" from Microsoft and I used the string given as comment above
the WCHAR array (since I don't know how to convert the WCHAR array for
Python).

But when creating the control with this string, the control is created
in "evaluation mode" and not, as expected, as a licensed control.

I looked up the code for the CreateControl() method and found out, that
it passes the license key string directly to the CreateControl() of the
PyCWnd class (the Python wrapper for the CWnd class of MFC). Than I
looked at the Python extension, where the PyCWnd::CreateControl() is
implemented, and found, that the macro T2OLE is used to convert the
given Python string for the license key to an OLE string, before
passing it to the original MFC method.

ok = pWnd->CreateControl(clsid, szWndName, style, rect, pWndParent, id,
NULL, bStorage, T2OLE(szLicKey));

I'm not sure, but when I understand this right, the MFC method
CreateControl() wants a BSTR here and I read somewhere that T2OLE does
not return a BSTR. Can this be the problem here?

Has anybody ever used the license key string parameter of the
CreateControl() method in Python and can tell my how to pass the
license key string correctly?

Thanks in advance.

Wolfgang Schneider
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,234
Messages
2,571,178
Members
47,809
Latest member
Adisty

Latest Threads

Top