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.

Author: Tukasa Zolora
Country: Samoa
Language: English (Spanish)
Genre: Photos
Published (Last): 19 July 2018
Pages: 290
PDF File Size: 5.93 Mb
ePub File Size: 3.99 Mb
ISBN: 217-8-23052-583-2
Downloads: 97746
Price: Free* [*Free Regsitration Required]
Uploader: Moogum

ShellExecute Sends Email using default mail client software installed on user’s system.

Using Shell Execute in Delphi

Note the added extra touch: Sign up or log in Sign up using Google. To make it easier to see what is happening, we made the window of the demo stay on top of all other windows. Sheellexecute Overflow works best with JavaScript enabled.

ShellExecute Handle, ‘print’, PChar ‘c: Sign up using Facebook. What happens next, depends from the state of the “Wait for termination” checkbox: If your application launches your own delpbi games, you have to figure out a clever way to communicate paths.


If your application is a felphi application launcher, you get the path from the user. The ‘return value’ is the value returned by the function.

People have been asking me over and over: Sometime we need some special directories path from Microsoft Windows system to store User data or to copy some files etc.

Delphi 7 – ShellExecute command not working in situations Ask Question. Open an HTML pagelocal or remote: Anyhow, what is the return value? ShellExecute Handle, ‘explore’, PChar ‘c: I can’t imagine why you neglected this. Open an HTML page, local or remote: Did you try starter.

Handle looks dubious at best. Of course, you have read the ShellExecute documentation carefully, so you know what the return values are.

This leads on to the fact that you should never call ShellExecute. It is trivially easy to launch your process. There’s no point writing code that doesn’t deal with errors.

I have made a Game Launcher and I use this command: For just running an external application, or opening a registered file, opening a folder, printing a file, and so on It just nothing happens. Of course, you should never hard-code such a string, since it may be different on different systems. That process handle can be obtained by using one of two Win32 API-functions to start the external program: There’s no point at all trying to persist with this.


Different ways of executing applications and files from Delphi

Launching an external sheloexecute and waiting until it is terminated is quite another story The active window remains active. Try passing the executable’s directory in the lpDirectory parameter to ShellExecute. If you have to resolve shell verbs, use ShellExecuteEx which does have proper error reporting. It gives some degree of control, and at the same time it’s not too complicated. What happens next, depends from the state of the “Wait for termination” checkbox:.

In any case it’s not needed. ShellExecute Handle, ‘open’, PChar ‘command.

These do not apply to ShellExecute. You link to an irrelevant set of error codes.