Using the DSKernel Object

C++ Example

These examples show you how to unlock the multimedia toolkit using the DSKernel object.

 

1.

To create the DSKernel object, use the Win32 CoCreateInstance function:

#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:

 

a.

To unlock the multimedia toolkit at the application level, use the following code before creating or using any multimedia objects:

pKernel->UnlockModule(L"LTMM_SERIAL_NUMBER", UNLOCK_APP_ONCE,  L"Application ID");

 

b.

To unlock the MPEG4 encoder at the application level, use the following code:

pKernel->UnlockModule(L"MPEG4_encoder_serial_number", UNLOCK_APP_ONCE, L"Application ID");

 

c.

To always unlock the multimedia toolkit for a particular application, you can use the following code during setup:

pKernel->UnlockModule(L"LTMM_SERIAL_NUMBER", UNLOCK_APP_PATH, L"c:\\Application\\full\\path.exe");

 

3.

To use the lock method, use the following code:

 

a.

To reverse the effects of unlocking the multimedia toolkit, and any modules, filters and codecs at the application level (case 'a'. and 'b.' above) and clean up any allocated memory, use the following code before exiting your app:

pKernel->LockModules(L"Application ID", LOCK_APP);

 

b.

To reverse the effects of unlocking all the filters and modules for a particular application (case 'c' above) and clean up any allocated memory, use the following code before uninstalling your app:

pKernel->LockModules(L"c:\\Application\\full\\path.exe", LOCK_APP_PATH);

 

3.

Free the DSKernel object as follows:

 

a.

pKernel->Release();

 

 

VB Example

1.

Before you can create the DSKernel object, add the DSKernel reference to the project using the "Project->References..." 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:

 

a.

To unlock the multimedia toolkit at the application level, use the following code before or using any multimedia objects:

pKernel.UnlockModule "LTMM_SERIAL_NUMBER", UNLOCK_APP_ONCE,  "Application ID"

 

b.

To unlock the MPEG4 encoder at the application level, use the following code:

pKernel.UnlockModule "MPEG4_encoder_serial_number", UNLOCK_APP_ONCE, "Application ID"

 

c.

To always unlock the multimedia toolkit for a particular application, you can use the following code during setup:

pKernel.UnlockModule "LTMM_SERIAL_NUMBER", UNLOCK_APP_PATH, "c:\Application\full\path.exe"

 

5.

To use the lock method, use the following code:

 

a.

To reverse the effects of unlocking the multimedia toolkit, and any modules, filters and codecs at the application level (case 'a'. and 'b.' above) and clean up any allocated memory, use the following code before exiting your app:

pKernel.LockModules "Application ID", LOCK_APP

 

b.

To reverse the effects of unlocking all the filters and modules for a particular application (case 'c' above) and clean up any allocated memory, use the following code before uninstalling your app:

pKernel.LockModules "c:\Application\full\path.exe", LOCK_APP_PATH

 

6.

Free the DSKernel object as follows:

Set pKernel = Nothing 

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.