Capturing a Selected Object (Builder 3.0)
Take the following steps to add code that will let you capture a selected object.
1. |
Start with the project that you created in Capturing an Active Window (Builder). |
|
2. |
Add a command button and name it as follows: |
|
|
Name |
Caption |
|
CapSelect |
Capture Selected |
3. |
Code the CapSelectClick procedure as follows: |
void __fastcall TForm1::CapSelectClick(TObject *Sender)
{
/*display the capture selected object dialog*/
LEADScr1->CaptureObjectOptionDlg(this);
/*capture the selected object*/
LEADScr1->CaptureSelectedObject();
/*assign the screen control bitmap to the Main control bitmap*/
LEAD1->Bitmap = LEADScr1->Bitmap;
/*reset the object options*/
LEADScr1->ResetObjectOptions();
}
4. |
Run your program to test it. Click the Capture Select button. Set the options and click OK. Select the window containing the object you want to capture. Press F11. Move the cursor over the object you wish to capture and click the left mouse button. |