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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

simonetCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.