How to pass a runtime license key to CreateControl()

wschneider at ra.rockwell.com wschneider at ra.rockwell.com
Mon Apr 11 09:01:39 EDT 2005


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




More information about the Python-list mailing list