Table of Contents
How can I open a specific URL with any Web Browser installed ?
How can I open a window of "New Mail" with any Mail Clients installed ?


How can I open a specific URL with any Web Browser installed ?
Sometimes, it is difficult to determine which Internet Browser is installed in the clients' PC. Therefore a simple method to open a specific URL is required. Don't forget add ShellAPI in USES clause !

if ShellExecute( Application.MainForm.Handle, nil, PChar( 'http://www.hianoto.net' ),
                 PChar( '' ), PChar( '' ), SW_SHOWNORMAL ) <= 32 then
  MessageDlg( 'Error in web browser', mtError, [ mbOk ], 0 );

Go Top


How can I open a window of "New Mail" with any Mail Clients installed ?
Here is the code snippet to open a window of "New Mail" with ANY Mail Client installed. Remember to add ShellAPI in USES clause.

if ShellExecute( Application.MainForm.Handle, nil, PChar( 'mailto:hian@hianoto.net',
                 PChar( '' ), PChar( '' ), SW_SHOWNORMAL ) <= 32 then
  MessageDlg( 'Error in mail client', mtError, [ mbOk ], 0 );

Go Top