LSettings::SetLicenseBuffer

Summary

Sets the runtime license for LEADTOOLS and unlocks support for optional features such as LEADTOOLS Imaging, Document and Medical Imaging capabilities, or PDF support.

Syntax

#include "ltwrappr.h"

static L_INT LSettings::SetLicenseBuffer(pLicenseBuffer, nSize, pszDeveloperKey)

Parameters

L_UCHAR * pLicenseBuffer

Pointer to a memory buffer that contains the entire LEADTOOLS runtime license.

L_SSIZE_T nSize

The size, in bytes, of the buffer pointed to by pLicenseBuffer.

L_TCHAR * pszDeveloperKey

Character string containing the developer key.

Returns

Value Meaning
SUCCESS The function was successful.
< 0 An error occurred. Refer to Return Codes.

Comments

You must use this function to set the runtime license for LEADTOOLS and to unlock support for any optional features that you have licensed. If you do not set a runtime license, your application will display a "nag" message dialog at runtime, indicating that you have developed the application without a valid runtime license.

In order to obtain a runtime license and developer key, you must contact LEAD. For more information, refer to About LEADTOOLS Runtime Licenses.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To determine if support for optional features has been unlocked, use the LSettings::IsSupportLocked function.

To set the runtime license from a disk file instead of a memory buffer, use the LSettings::SetLicenseFile function

Note: To avoid receiving WRPERR_LTKRN_DLL_NOT_LOADED return value, call LBase::LoadLibraries(LT_KRN) prior to calling this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

#define MY_LICENSE_FILE L_TEXT("d:\\temp\\TestLic.lic") 
#define MY_DEVELOPER_KEY L_TEXT("xyz123abc") 
 
L_INT LSettings__SetLicenseBufferExample() 
{ 
   LSettings LeadSettings; 
 
   /* read the file */ 
   HANDLE hFile = CreateFile(MY_LICENSE_FILE, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); 
   DWORD dwSize = GetFileSize(hFile, NULL); 
   L_UCHAR* pBuf = (L_UCHAR*)malloc(dwSize); 
   DWORD dwRead=0; 
   ReadFile(hFile, (LPVOID)pBuf, dwSize, &dwRead, NULL); 
   CloseHandle(hFile); 
 
   /* set the runtime license */ 
   LeadSettings.SetLicenseBuffer(pBuf, dwRead, MY_DEVELOPER_KEY); 
 
   free(pBuf); 
 
   /* check for unlocked support */ 
   if (LeadSettings.IsSupportLocked(L_SUPPORT_MEDICAL)) 
      MessageBox(NULL, L_TEXT("Medical Locked\n"), L_TEXT(""), MB_OK); 
   else 
      MessageBox(NULL, L_TEXT("Medical Unlocked\n"), L_TEXT(""), MB_OK); 
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.