How to Run Programs and Execute Documents, MailTo: Links and URLs

The easiest way to open a document, program or URL is to use the Windows API ShellExecute() function. Thanks to this function you can execute almost everything in Windows.

uses ShellAPI;
...
(* sObject - (string) the program, document, URL, ... that you want to
** open. This can be:
**
** a document - 'C:\My Documents\Tips.txt'
** a program - 'notepad.exe' or 'C:\Program Files\WinRar\WinRar.exe'
** an URL - 'http://www.delphifaq.net/'
** an e-mail link - 'mailto: m3Rlin@delphifaq.net'
**
** E-Mail link:
** mailto: _e_mail_address_ ?Subject= _Subject_ &body= _e_mail_text_
** &bcc= _blind_carbon_copy_addresses &cc= _carbon_copy_addresses
**
** If you want to add the &body= tag then remember to convert all the
** line ends (#13#10) to this sequence - %0A%0D
*)
ShellExecute(0, nil, PChar(sObject), nil, nil, SW_NORMAL);

Tags: , , , , , , , , , , , , , , , , , , ,

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login