Internet Shortcuts

Please can anyone tell me how to resolve an Internet Shortcut into a URL?

I have written an application to process IE Favorites Folder, but I cannot resolve the .URL file name into a valid URL.

The MSDN Library mentions an Interface called IUniformResourceLocator, but I cannot find out how to use it.

Thanks

Adrian

archapmanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
simonetConnect With a Mentor Commented:
Internet Shortcut files are nothing more than simple text files with the extension .URL file. The format of the file is:

[InternetShortcut]
URL=http://www.bhnet.com.br/~simonet


So, as you can see, it is very similar in format to an INI file. In order to retrieve the URL from a .URL file, simply load the file into a TStringList and read the value "URL". In code, this is something similar to:

function URLFromShortCutFile(AFIleName : string) : string;
var
  ls : TStringList;
begin
  ls := TStringList.create;
  try
     ls.LoadFromFile(AFileName);
     Result := ls.Values['URL'];
  finally
     ls.free;
  end;
end;

So, it works like this:

var
  URL : string;
begin
  URL := URLFromShortCutFile('Athenas Place.URL');


{ the resulting value will be http://www.bhnet.com.br/~simonet }

Yours,

Alex
0
All Courses

From novice to tech pro — start learning today.