There are several ways of executing files and applications from Delphi. All use the ShellAPI unit and either the ShellExecute or ShellExecuteEx. Launch files and programs from your code using Delphi. ShellExecute is Delphi Windows API function that is mostly used for launch external applications from our Delphi application. This function is.
|Published (Last):||18 January 2009|
|PDF File Size:||20.70 Mb|
|ePub File Size:||8.22 Mb|
|Price:||Free* [*Free Regsitration Required]|
Always check for errors.
To make it easier to see what is happening, we made the window of the demo stay on top of all other windows. However, in this scenario it is CreateProcess selphi is needed.
Use ShellExecuteEx when you need to get the shell to work out how to resolve a shell verb. What happens next, depends from the state of the “Wait for termination” checkbox: I think you should pass an absolut path constructed at run-time.
Running external applications: ShellExecute and ShellExecuteEx
If the window is minimized or maximized, Windows restores it shellexeute its original size and position. ShellExecuteEx is your guy. TObject ; var ExecuteResult: How to open my browser with a local HTML page? Anyhow, what is the return value? Use CreateProcess to create processes. Clicking the first button will launch the external application that is specified in the first edit-box.
ShellExecute Handle, ‘explore’, PChar ‘c: Open an HTML pagelocal or remote: Of course, you have read the ShellExecute documentation carefully, so you know what the return values are. But it will not work with attachment for every sheklexecute client. ShellExecute function documentation Most common error codes: EX – PChar filename.
Different ways of executing applications and files from Delphi
Email Required, but never shown. By the way, you could have figured all this out by yourself by looking at the return value of ShellExecute.
By using ShellExecute we can also do following operations You link to an irrelevant set of error codes. When i want to relocate the launcher outside this folder i use this command:.
AndreasRejbrand Actually, ShellExecute is shfllexecute useless when it comes to reporting errors. Launching an external program and waiting until it is terminated is quite another story FileName, link URL to open and modify. You can find list of error codes at: For this Excel or later should have installed in our system. You can get the unit in installed path C: We can tell if a process has completed by monitoring its process handle.
For instance, if you know that the path is C: ShellExecute Handle, ‘print’, PChar ‘c: When i want to relocate the launcher outside this folder i use this command: Post as a shellexxecute Name.
Delphi 7 – ShellExecute command not working in situations – Stack Overflow
If I have left something please feel free to add comments. And when you click on one of the underlined labels, an HTML file will be loaded in your browser: You have to use full path to the application you are trying to start.
Note the added extra touch: