Writing Windows Media Files Example for Visual Basic
You do not need do use software certificates on computers with Windows Media 9 Components or later. For more information, please go to Windows Media Support.
To write Windows Media files on computers without Windows Media 9 components, an application must provide a software certificate, also called a key, at run time. For details on obtaining the certificate, see the Windows Media Format SDK. For more information on Window Media Support, click here. In order to supply the certificate to the LEADTOOLS multimedia toolkit, you will need to modify and build the wmstub dll project. This will require Microsoft Visual C++. The steps are as follows:
1. |
Open the wmstub.dsw workspace, located in the vb examples directory, with Microsoft Visual C++. |
2. |
Open wmstub.cpp in the FileView section of the Workspace. |
3. |
Insert the full path to the wmstub.lib file, obtained from Microsoft, into the pragma statement. |
4. |
Insert a unique key into the g_pszKey declaration to prevent others from obtaining you certificate. |
5. |
Open the Version resource in the ResourceView section of the Workspace. |
6. |
Change the copyright notice, file version, etc. |
7. |
Select the Project->Settings menu. |
8. |
Select the Link tab. |
9. |
Choose General in the Category drop down list. |
10. |
Change the Output file name to a name unique to your project. |
11. |
Click the OK button. |
12. |
Select the Build->Rebuild All menu item. |
13. |
Copy the generated DLL to the directory of your choice. |
To use your new DLL from VB use the following steps:
1. |
Declare the Certificate function in your VB application. Make sure that you use the name or full path of your generated DLL. |
Private Declare Function LTMM_WMCreateCertificate Lib "wmstub" (ByVal pszKey As String) As Object
2. |
Create and assign the certificate to the LEADTOOLS object in your code’s initialization procedure. Make sure you supply your private password to the creation function. |
Private Sub Form_Load()
ltmmConvertCtrl1.WMCertificate = LTMM_WMCreateCertificate("_WMSTUB_")
ltmmCaptureCtrl1.WMCertificate = LTMM_WMCreateCertificate("_WMSTUB_")
ltmmPlayCtrl1.WMCertificate = LTMM_WMCreateCertificate("_WMSTUB_")
End Sub
Important Notes:
1. |
Make sure that you generate a DLL with a different name. Otherwise, other LEADTOOLS customers could potentially overwrite your file. |
2. |
Defining a unique password is critical for protecting your Certificate for illegal distribution. |