Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
snapshot of the browser
snapshot of the browser
Hello. I'm trying to get a snapshot of the browser, I'm using CopyRect but I get a white screen. Help me solve this problem
Re: snapshot of the browser
This worked for me. Taken from one of the sample projects:
Code: Select all
// init stream...
procedure TForm1.FormCreate(Sender: TObject);
begin
FSnapshotFileStream := nil;
end;
// free stream (if still active)
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FreeAndNil(FSnapshotFileStream);
end;
// take snapshot...
procedure TForm1.Snapshot(filename:string);
var
adapter:IStream;
begin
FreeAndNil(FSnapshotFileStream);
SnapshotFileStream := TFileStream.Create(filename, fmCreate);
try
adapter := TStreamAdapter.Create(FSnapshotFileStream, soReference);
browser.CapturePreview(COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT_JPEG, adapter);
finally
adapter := nil;
end;
end;
// snapshot finished...
procedure TForm1.OnCapturePreviewCompleted(Sender: TObject;aErrorCode: HRESULT);
begin
FreeAndNil(FSnapshotFileStream);
end;
Re: snapshot of the browser
Thanks! It works! The best