«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» Help

Open documents and URLs in their associated applications


If you like how Windows Explorer and File Manager lets you open documents just by double clicking on them, without opening the associated program first, here's how to achieve similar functionality from your Delphi program:

program ShellExe;

  WinTypes, ShellAPI;

procedure OpenObject(sObjectPath: string);
  ShellExecute(0, nil, PChar( sObjectPath ), nil, nil, SW_NORMAL);


Now you can open any type of document from your program without knowing which program is associated with it.

Don't forget that web site addresses and other URLs also have programs associated with them. So, if you want to open the default browser to a specific URL, simply call OpenObject() with the absolute URL as follows:


You can also use the same function to run executable programs, for example:

To run programs and wait until they have completed see "Execute a program and wait until it is done".
Author: Unknown
Added: 2007-06-02
Last updated: 2007-10-12

« Return to contents »