ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Using CaptureFromScreen without object-instance?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

864 Posts

Posted - Apr 15 2020 :  03:53:24  Show Profile  Reply
Is it possible to use TImageEnIO.CaptureFromScreen without using an existing instance of TImageEnView or without having to create a new instance of TImageEnView, by just using the referenced ImageEnView classes?

xequte

38222 Posts

Posted - Apr 15 2020 :  04:40:03  Show Profile  Reply
Hi Peter

No, but you can just create a TImageEnIO:

// Capture primary window to a bmp
var
  bmp: TIEBitmap;
  IO: TImageEnIO;
begin
    bmp := TIEBitmap.Create;
    IO := TImageEnIO.CreateFromBitmap( bmp );
    try
      IO.CaptureFromScreen( iecsPrimary );
      ... do something with bmp ...
    finally
      IO.Free;
      bmp.Free;
    end;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

864 Posts

Posted - Apr 15 2020 :  05:11:50  Show Profile  Reply
Hi Nigel,

the bmp identifier in your source code example is not referenced in the capturing process. I need to copy the captured screenshot to the clipboard.
Go to Top of Page

PeterPanino

864 Posts

Posted - Apr 15 2020 :  05:21:22  Show Profile  Reply
I've tried this:

var
  bmp: TIEBitmap;
  IO: TImageEnIO;
begin
  bmp := TIEBitmap.Create;
  IO := TImageEnIO.CreateFromBitmap(bmp);
  try
    IO.CaptureFromScreen(iecsSpecifiedWindowClient, -1, FAppWindowHandle);
    IO.IEBitmap := bmp;
    bmp.CopyToClipboard(False);
  finally
    IO.Free;
    bmp.Free;
  end;


It works. But is it correct?
Go to Top of Page

PeterPanino

864 Posts

Posted - Apr 15 2020 :  05:28:14  Show Profile  Reply
Sorry, I didn't read the DOCUMENTATION, where it says:

TImageEnIO.CreateFromBitmap: Creates a new instance of TImageEnIO, assigning the property AttachedIEBitmap or AttachedBitmap.
Go to Top of Page

xequte

38222 Posts

Posted - Apr 15 2020 :  17:24:43  Show Profile  Reply
Hi Peter

Sorry, were you able to resolve the issue?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

864 Posts

Posted - Apr 15 2020 :  18:11:53  Show Profile  Reply
Yes. Sorry for my stupidity. ;-)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: