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:

 

a.

To unlock all video filters at the computer level, use the following code:

pKernel->UnlockModule(“All video filters serial number”, UNLOCK_COMPUTER,  “Application ID”);

 

b.

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

pKernel->UnlockModule(“MPEG4 encoder serial number”, UNLOCK_COMPUTER, “Application ID”);

 

c.

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:

 

a.

To lock all video filters at the computer level, use the following code:

pKernel->LockModules(“Application ID”, LOCK_COMPUTER);

 

 

b.

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:

 

a.

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:

 

a.

To unlock all video filters at the computer level, use the following code:

pKernel.UnlockModule “All video filters serial number”, UNLOCK_COMPUTER,  “Application ID”

 

b.

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

pKernel.UnlockModule “MPEG4 encoder serial number”, UNLOCK_COMPUTER, “Application ID”

 

c.

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:

 

a.

To lock all video filters at the computer level, use the following code:

pKernel.LockModules  “Application ID”, LOCK_COMPUTER

 

b.

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