Ian Boyd
Ian Boyd

Reputation: 257075

Delphi: OpenFileDialog crashes with URL

Giving a URL to the TOpenFileDialog, the Execute method throws an exception:

OpenDialog1.Filename := 'http://www.osfi-bsif.gc.ca/app/DocRepository/1/eng/issues/terrorism/indstld_e.xls';
bResult := OpenDialog1.Execute;

But you are allowed to open files from a URL.

Delphi 5

Upvotes: 0

Views: 1210

Answers (1)

Lawrence Barsanti
Lawrence Barsanti

Reputation: 33352

TOpenDialog is just a wrapper for the windows function GetOpenFileName in comdlg32.dll.

function TOpenDialog.Execute(ParentWnd: HWND): Boolean;
begin
  Result := DoExecute(@GetOpenFileName, ParentWnd);
end;

Unfortunately the documentation for this function isn't that great. But I'm pretty sure it doesn't support http.

Upvotes: 3

Related Questions