Using ltmmCaptureCtrl to Perform Simple Still Image Capture (Delphi 6.0)

1.

Start with the project that you created in My First Capture.

2.

Add a Button control to your form, and name it as follows:

 

Name

Caption

 

btnGetFreeDIB

Get and Free Captured Bitmap

3.

Update the btnStartCaptureClick procedure to be as follows:

procedure TForm1.btnStartCaptureClick(Sender: TObject); 
begin
 ltmmCaptureCtrl1.StartCapture ( ltmmCapture_Mode_Still ); 
end; 

4.

Handle the btnGetFreeDIB OnClick event, and code btnGetFreeDIBClick procedure as follows:

procedure TForm1.btnGetFreeDIBClick(Sender: TObject); 
var
 hDIB: Integer; 
begin
   hDIB:= ltmmCaptureCtrl1.GetStillDIB ( 100 ); 
   if ( hDIB <> 0 ) then
   begin
   ShowMessage ( 'Operation done successfully' ); 
      GlobalFree ( hDIB ) ; 
   end; 
end;

5.

Run your program to test it.