Take the following steps to create and run a multimedia capture application using the LEADTOOLS Media Foundation CaptureCtrl control.
Start Visual Studio .NET.
Choose File->New->Project... from the menu.
In the New Project dialog box, choose either "Visual C# Projects" or "VB Projects" in the Projects Type List, and choose "Windows Application " in the Templates List.
Type the project name as "Multimedia Capture" in the Project Name field, and then choose OK. If desired, type a new location for your project or select a directory using the Browse button, and then choose OK.
In the "Solution Explorer" window, right-click on the "References" folder, and select "Add Reference..." from the context menu. In the "Add Reference" dialog box, select the ".NET" tab and select Leadtools.MediaFoundation and click OK. If this DLL does not appear under the .NET tab, you will need select the Browse tab and add it from the "<LEADTOOLS_INSTALLDIR>\Bin\Dotnet\Win32 " folder, by selecting the following DLL:
After browsing, click the Select button and then press the OK button to add the above DLL to the application.
Make sure Form1 is in design view. Go to the toolbox (View->Toolbox) and drag and drop a CaptureCtrl control on the form. NOTE: If you do not have CaptureCtrl in your toolbox, select Tools->Choose Toolbox Items from the menu. Click Browse and then select Leadtools.MediaFoundation.dll from "<LEADTOOLS_INSTALLDIR>\Bin\Dotnet\Win32" and then click Open and then click OK. After adding it to the form, set the following properties on the capture control:
Property | Value |
---|---|
Name | _capturectrl |
Anchor | Top, Bottom, Left, Right |
Go to the toolbox (View->Toolbox) and drag and drop a ProgressBar control on the form (below the capture control) and set the following properties:
Property | Value |
---|---|
Name | _progress |
Anchor | Bottom, Left, Right |
Go to the toolbox (View->Toolbox) and drag and drop a Button control on the bottom of the form and set the following properties:
Property | Value |
---|---|
Name | _buttonCapture |
Text | Capture |
Anchor | Bottom, Right |
Switch Form1 to code view (right-click Form1 in the solution explorer then select View Code) and add the following lines at the beginning of the file:
Declare the following private variables:
Add an event handler to the Form1 Load event and code it as follows:
Add an event handler to the _capturectrl Progress event and code it as follows:
Add an event handler to the _capturectrl Complete event and code it as follows:
Add an event handler to the _buttonCapture Click event and code it as follows:
Build, and Run the program to test it.
Products |
Support |
Feedback: Creating a MediaFoundation Capture Application |
Introduction |
Help Version 19.0.2017.6.16
|