Capturing a Selected Object (Delphi 4.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 (Delphi). |
|
2. |
Add a command button and name it as follows: |
|
|
Name |
Caption |
|
CapSelect |
Capture Selected |
3. |
Code the CapSelectClick procedure as follows: |
procedure TForm1.CapSelectClick(Sender: TObject);
begin
{display the capture selected object dialog}
LEADScr1.CaptureObjectOptionDlg(Self);
{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();
end;
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. |