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.
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);
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);
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);
Free the DSKernel object as follows:
pKernel->Release();
VB Example
To create the DSKernel object, add the DSKernel reference to the project using the Project->Reference menu item.
Declare the DSKernel object as follows:
Dim pKernel As LMDSKernel2
Create the DSKernel object as follows:
Set pKernel = New LMDSKernel2
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
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
Free the DSKernel object as follows:
Set pKernel = Nothing
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:
Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).
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:
Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).
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.
VB6 demos
In VB6 demos, you need to use the UnlockSupport and the LockSupport methods (macros) to unlock and lock the LTMM. These methods are available in the UnlockSupport.bas file that is located in the \vb\common folder in the Multimedia Toolkit example folder. The demo should contain the following array:
Dim ppszBaseKeys(1) As String
ppszBaseKeys(0) = LTMM_SERIAL_NUMBER
This array contains the Public Const 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.bas file that is located in the \vb\common folder in the Multimedia Toolkit example folder. You need to replace MySerial with a proper 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:
Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).
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:
Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).
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.
VB.NET demos
In VB.NET 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.vb file that is located in the \DotNet\VB\common folder in the Multimedia Toolkit example folder. The demo should contain the following array:
Dim unlocklsprt As New UnlockSupport
Dim ppszBaseKeys() As String = {LtmmSerialNumber.LTMM_SERIAL_NUMBER}
This array contains the Public Shared LTMM_SERIAL_NUMBER As String = "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.vb file that is located in the \DotNet\VB\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:
Add a new define in the LtmmSerialNumber.h for the new module (i.e. DVDBURNER_SERIAL_NUMBER).
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 app.
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.