Capturing Multiple Images (Builder 3.0)

Take the following steps to add code that will let you capture multiple images.

 

1.

Start with the project that you created in Capturing an Icon from an EXE (Builder).

2.

Add two command buttons and name them as follows:

 

Name

Caption

 

CapMulti

Capture Multi

 

Display

Display Multi

 

3.

Code the CapMultiClick procedure as follows:

void __fastcall TForm1::CapMultiClick(TObject *Sender)

{

/*set the cancel key*/
LEADScr1->CaptureCancelKey = VK_ESCAPE;
/*set the delay, the interval, and the number  ) { captures to perform*/
LEADScr1->CaptureDelay = 2000;
LEADScr1->CaptureInterval = 2000;
LEADScr1->CaptureCount = 3;
/*capture*/
LEADScr1->CaptureActiveClient();

}

 

4.

Code the DisplayClick procedure as follows:

void __fastcall TForm1::DisplayClick(TObject *Sender)

{

LEAD1-> Load("D:\\Temp\\Multi.tif", 0, 1, 1);
LEAD2->Load("D:\\Temp\\Multi.tif", 0, 2, 1);
LEAD3->Load("D:\\Temp\\Multi.tif", 0, 3, 1);
/*remove the tif file so you can capture and display again without having to restart the program*/
DeleteFile("D:\\Temp\\Multi.tif");

}

5.

Code the OnCaptureImage procedure as follows:

void __fastcall TForm1::LEADScr1CaptureImage(TObject *Sender,

      int nCurrentPageNumber)

{

/*copy the captured image to the Main control and save it*/
LEAD1->Bitmap = LEADScr1->Bitmap;
LEAD1-> Save("D:\\Temp\\Multi.tif", FILE_TIF, 0, 2, SAVE_APPEND);

}

6.

Run your program to test it. Click on Capture Multi, press F11, and then select the window(s) you wish to capture, at the proper times. You may want to decrease the capture interval in the code. To view the images you captured, click on the Display command button after capturing has ended.