Thanks for your work. You are amazing.
WVBrowser1.CoreWebView2.BaseIntf.ExecuteScript('this.document.execCommand("SelectAll", true);',ICoreWebView2ExecuteScriptCompletedHandler(
function (errorCode: HResult; resultObjectAsJson: PWideChar): HResult stdcall
begin
Result := S_OK;
end))
WVBrowser1.CoreWebView2.BaseIntf.ExecuteScript('this.document.execCommand("copy");',ICoreWebView2ExecuteScriptCompletedHandler(
function (errorCode: HResult; resultObjectAsJson: PWideChar): HResult stdcall
begin
Result := S_OK;
end))
WVBrowser1.CoreWebView2.BaseIntf.ExecuteScript('window.getSelection().removeAllRanges();',
ICoreWebView2ExecuteScriptCompletedHandler(
function (errorCode: HResult; resultObjectAsJson: PWideChar): HResult stdcall
begin
Result := S_OK;
end));
Procedure FindText(Const aText:String;aCaseSensitive, aBackwards, aWrapAround,
aWholeWord, aSearchInFrames:Boolean);
begin
if not WVBrowser1.Initialized then exit;
WVBrowser1.CoreWebView2.BaseIntf.ExecuteScript(PWideChar(Format('window.find("%s",%s,%s,%s,%s,%s,false)',[
aText,
BoolToStr(aCaseSensitive,true).ToLower,
BoolToStr(aBackwards,true).ToLower,
BoolToStr(aWrapAround,true).ToLower,
BoolToStr(aWholeWord,true).ToLower,
BoolToStr(aSearchInFrames,true).ToLower
])),
ICoreWebView2ExecuteScriptCompletedHandler(
function (errorCode: HResult; resultObjectAsJson: PWideChar): HResult stdcall
begin
Result := S_OK;
end));
procedure TFormBrowserEDGE.FindDialog1Find(Sender: TObject);
begin
inherited;
FindText(FindDialog1.FindText,
frMatchCase in FindDialog1.Options,
not (frDown in FindDialog1.Options),
true,//??
frWholeWord in FindDialog1.Options,
True//??
)
end;