Ide Indy Delphi

Title: How do I execute another program from my Delphi Application?
This is surprisingly easy to do.
First ensure that ShellApi is in a uses statement.
CODE
Uses ShellApi;
Then call ShellExecute. This function takes six parameters but at its simplest it can be called as follows:
CODE
ShellExecute(0, 'Open', PChar(App), PChar(''), PChar(''), SW_Hide);
Where App is the full path name of the application you wish to call OR it is the name of a file which is associated with an application.
Examples:
If you wish to start an application called 'MyApp.exe' from within your Delphi application then you would code something like
CODE
ShellExecute(0, 'Open', PChar('c:\Apps\MyApp.exe'), PChar(''), PChar(''), SW_Hide);
If you have Microsoft Word installed on your computer then it is likely that
CODE
ShellExecute(0, 'Open', PChar('c:\My Documents\Biography.doc'), PChar(''), PChar(''), SW_Hide);
would start Word and open your document called Biography.doc.
Parameter 4 allows you to pass parameters to your program. For example, if your program required two digits as parameters then you would code something like:-
CODE
ShellExecute(0, 'Open', PChar('c:\Apps\MyApp.exe'), PChar('123 999'), PChar(''), SW_Hide);
Parameter 5 allows you to specify a default directory to your application. For example, your program might require a temporary directory:
CODE
ShellExecute(0, 'Open', PChar('c:\Apps\MyApp.exe'), PChar('123 999'), PChar('c:\temp'), SW_Hide);
Note that the application that calls ShellExecute does not suspend whilst the called program is running. Both programs will be executing at the same time. The next FAQ (coming shortly) will show you how to suspend your program until the called program completes.
The Windows SDK Help provides details of what each of the parameters are used for and what the returned value from ShellExecute means.