Using the DSKernel Object

C++ Example

In order to use the DSKernel object, you must create an instance of the LMDSKernel2 class. This is accomplished by using the Win32 CoCreateInstance function.

  1. To create the DSKernel object, use the following code:

    #include "ILMDSKernel2.h" 
    ILMDSKernel2* pKernel = NULL; 
    HRESULT hr = CoCreateInstance(CLSID_LMDSKernel2, NULL, CLSCTX_INPROC_SERVER, IID_ILMDSKernel2, (void**) &pKernel); 

  2. To use the unlock method, use the following code (various examples):

    pKernel->UnlockModule (All video filters serial number, UNLOCK_COMPUTER,  Application ID); 
    // To unlock the MPEG4 encoder at the computer level, use the following code: 
    pKernel->UnlockModule(MPEG4 encoder serial number, UNLOCK_COMPUTER, Application ID); 
    // To unlock a filter at the application level, use the following code: 
    pKernel->UnlockModule(Filter serial number, UNLOCK_APP_ONCE, Application ID); 

  3. To use the lock method, use the following code (various examples):

    pKernel->LockModules (Application ID, LOCK_COMPUTER); 
    // To lock the MPEG4 encoder at the application level, use the following code: 
    pKernel->LockModules(Application ID, LOCK_APP); 

  4. Free the DSKernel object as follows:

    pKernel->Release(); 

VB Example

  1. To create the DSKernel object, add the DSKernel reference to the project using the Project->Reference menu item.

  2. Declare the DSKernel object as follows:

    Dim pKernel As LMDSKernel2 

  3. Create the DSKernel object as follows:

    Set pKernel = New LMDSKernel2 

  4. To use the unlock method, use the following code (various examples):

    pKernel.UnlockModule All video filters serial number, UNLOCK_COMPUTER,  Application ID 
    ' To unlock the MPEG4 encoder at the computer level, use the following code: 
    pKernel.UnlockModule MPEG4 encoder serial number, UNLOCK_COMPUTER, Application ID 
    'To unlock a filter at the application level, use the following code: 
    pKernel.UnlockModule  Filter serial number, UNLOCK_APP_ONCE, Application ID 

  5. To use the lock method, use the following code (various examples):

    pKernel.  Application ID, LOCK_COMPUTER 
    ' To lock the MPEG4 encoder at the application level, use the following code: 
    pKernel.LockModules  Application ID, LOCK_APP 

  6. Free the DSKernel object as follows:

    Set pKernel = Nothing 

Unlocking DSKernel Unlock Support in Demos

C Demos

In C demos, you need to use the UnlockSupport and the LockSupport methods to unlock and lock the LTMM. These methods are available in UnlockSupport.h and UnlockSupport.c files that located in the \c\common folder in the Multimedia Toolkit Example folder. The UnlockSupport.c file contains the following array:

static LPCWSTR ppszBaseKeys[] = 
{ 
   LTMM_SERIAL_NUMBER, // Multimedia Toolkit serial number (defined in ltmmSerialNumber.h) 
   // insert additional Base keys here 
   NULL,               // terminates array 
}; 

This array contains the #define LTMM_SERIAL_NUMBER L"MySerial" define that has the LTMM serial number to be used to unlock the Multimedia Toolkit functionality. The mentioned key is defined in the \include\ltmmSerialNumber.h file in the LTMM installation folder. You need to replace MySerial with a valid serial number in order for the toolkit to operate in release (non-evaluation) mode.

If you want to unlock additional keys, perform the following steps:

  1. Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).

  2. Add this define to the ppszBaseKeys array in UnlockSupport.c.

Note: It is important that your application relock support before exiting to free resources allocated by the lock.

C++ demos

In C++ demos, you need to use the UnlockSupport and the LockSupport methods to unlock and lock the LTMM. These methods are available in the UnlockSupport.h and UnlockSupport.cpp files that are located in the \cpp\common folder in the Multimedia Toolkit example folder. The UnlockSupport.cpp file contains the following array:

static LPCWSTR ppszBaseKeys[] = 
{ 
   LTMM_SERIAL_NUMBER, // Multimedia Toolkit serial number (defined in ltmmSerialNumber.h) 
   // insert additional Base keys here 
   NULL,               // terminates array 
}; 

This array contains the #define LTMM_SERIAL_NUMBER L"MySerial" define that has the LTMM serial number to be used to unlock the Multimedia Toolkit functionality. The mentioned key is defined in the \include\ltmmSerialNumber.h file in the LTMM instillation folder. You need to replace MySerial with a valid serial number in order for the toolkit to operate in release (non-evaluation) mode.

If you want to unlock additional keys, perform the following steps:

  1. Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).

  2. Add this define to the ppszBaseKeys array in UnlockSupport.c.

Note: It is important that your application relock support before exiting to free resources allocated by the lock.

C# demos

In C# demos, you need to use the Unlock and the Lock methods from the UnlockSupport class to unlock and lock the LTMM. These methods are available in the UnlockSupport.cs file that is located in the \DotNet\CS\common folder in the Multimedia Toolkit example folder. The demo should contain the following array:

string[] ppszBaseKeys = 
{ 
   LtmmSerialNumber.LTMM_SERIAL_NUMBER, // multimedia toolkit serial number (defined in ltmmSerialNumber.cs) 
   // insert additional Base keys here 
}; 

This array contains the static public string LTMM_SERIAL_NUMBER = "MySerial" define that has the LTMM serial number to be used to unlock the Multimedia Toolkit functionality. The mentioned key is defined in the ltmmSerialNumber.cs file that is located in the \DotNet\CS\common folder in the Multimedia Toolkit example folder. You need to replace MySerial with a valid serial number in order for the toolkit to operate in release (non-evaluation) mode.

If you want to unlock additional keys, perform the following steps:

  1. Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).

  2. Add this define to the ppszBaseKeys array in UnlockSupport.c.

Note: It is important that your application relock support before exiting to free resources allocated by the lock.

Notes and comments

A typical application would unlock the multimedia toolkit and several video filters and codecs at the application level. You should do all this unlocking before using any multimedia objects or any of these filters and codecs. You achieve this by calling UnlockModule one or more times.

DSKernel allocates memory and storage resources during the unlocking process. To clean that, you should call LockModules before exiting the application.

If you used the same application ID (as you should) when you unlocked all the modules, one call to LockModules is enough to free the memory allocated for all the modules.

Help Version 23.0.2024.9.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

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