Page 1 of 1

[C++ Builder XE] Unlocking the toolkit

Posted: Wed May 16, 2012 1:05 pm
by Loïc

Code: Select all


#include "ComObj.hpp"
#include "GdPicture_NET_9_TLB.h"

void unlock()
{
   _LicenseManagerPtr oLicenseManager;
   oLicenseManager = (_LicenseManagerPtr)CreateComObject(CLSID_LicenseManager);
   BSTR bstrTest = ::SysAllocString(L"YOUR_LICENSE_KEY");
   oLicenseManager->RegisterKEY(bstrTest);
   ::SysFreeString(bstrTest);
   bstrTest = NULL;
}
/!\ In addition, in the main form constructor (OnCreate event) you need to add these two lines, otherwise you could have errors such as div by 0 due to differences between Borland/Embarcadero and Microsoft compilers :

Code: Select all

#include <WTypes.h>
Set8087CW(0x133f);

Note: To import the SDK in the ActiveX Palette: Components / Import Component... / Import ActiveX Control / Select GdPicture.NET / select Generate Component Wrappers / Install to a new Package / use GdPicture as package name / Finish.

If you have any question just let reply this ticket!

Re: [C++ Builder XE] Unlocking the toolkit

Posted: Thu Jun 16, 2016 12:55 am
by Max
C++ Builder has a type for COM object communication: OleStr. No need to allocate and free buffers for every string passed into the GdPicture components.
Drop the TLicenseManager control on a form (here named LicenseManager)

Code: Select all

#include <GdPicture_NET_12_TLB.h>

bool unlock(void) {
  return LicenseManager->RegisterKEY(OleStr(L"YOUR_LICENSE_KEY").c_bstr());
}
returns true on success.

Re: [C++ Builder XE] Unlocking the toolkit

Posted: Fri Jun 17, 2016 10:29 am
by Loïc
Thank you very much for this precision Max! :D