views:

489

answers:

2

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

A: 

Where does it say it is allowed? I don't remember that working when I was using Delphi 5, but that was 8 or so years ago, so I may just have forgotten

tim_yates
+3  A: 

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.

Lawrence Barsanti
Well holy crap. Try going to notepad and entering http://www.google.com/robots.txt in the open file dialog.
Blorgbeard
of course, that might not be the standard GetOpenFileName function..
Blorgbeard