My First Capture (Visual Basic)
Using the following steps to create a Visual Basic project and use MM Capture control to capture video data:
1. |
Start Visual Basic. |
2. |
Add the LEAD Multimedia controls to your project. On the Project pull-down menu, use the Components option, and select the LEAD Multimedia Library (14). |
3. |
Select the ltmmCaptureCtrl Control, and add it to your form. Size and position the control, as you want it to appear at run time. |
4. |
Handle the Form’s Load event, and code Form_Load sub as follows: |
Private Sub Form_Load()
'select first video device
ltmmCaptureCtrl1.VideoDevices.Selection = 0
'use preview
ltmmCaptureCtrl1.Preview = True
End Sub
5. |
Add two buttons and name them as follows: |
|
|
Name |
Caption |
|
btnStartCapture |
Start Capture |
|
btnStopCapture |
Stop Capture |
6. |
Handle the btnStartCapture Click event, and code btnStartCapture_Click procedure as follows: |
Private Sub btnStartCapture_Click()
ltmmCaptureCtrl1.StartCapture ltmmCapture_Mode_Video
End Sub
7. |
Handle the btnStopCapture Click event, and code btnStopCapture_Click procedure as follows: |
Private Sub btnStopCapture_Click()
ltmmCaptureCtrl1.StopCapture
End Sub
8. |
Run your program to test it. |
9. |
Save this project to use it as the starting point for other tutorials. |