[C++ Builder XE] Unlocking the toolkit

Discussions about GdPicture.NET usage in non managed applications built in vb6, Delphi, vfp, MFC c++ etc...
Post Reply
User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

[C++ Builder XE] Unlocking the toolkit

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

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!

Max
Posts: 1
Joined: Thu Jun 16, 2016 12:46 am

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

Post by Max » Thu Jun 16, 2016 12:55 am

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.

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

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

Post by Loïc » Fri Jun 17, 2016 10:29 am

Thank you very much for this precision Max! :D

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests