I'm using the miniBrowser Demo as a prototype.
Though I want to manage the download directory myself, right now it is always going to my Downloads directory. Even when I set the directory under Edge Settings to a different directory.
It seems as if it is hard-coded.
Code: Select all
procedure TMiniBrowserFrm.WVBrowser1DownloadStarting(Sender: TObject; const aWebView: ICoreWebView2; const aArgs: ICoreWebView2DownloadStartingEventArgs);
var
TempArgs : TCoreWebView2DownloadStartingEventArgs;
begin
TempArgs := TCoreWebView2DownloadStartingEventArgs.Create(aArgs);
TempArgs.ResultFilePath:='D:\EdgeDownloads\';
if assigned(TempArgs.DownloadOperation) and not(assigned(FDownloadOperation)) then
begin
FDownloadOperation := TCoreWebView2DownloadOperation.Create(TempArgs.DownloadOperation, GetNextDownloadID);
FDownloadOperation.AddAllBrowserEvents(WVBrowser1);
// We hide the download window
TempArgs.Handled := true;
end;
FreeAndNil(TempArgs);
end;