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: Brak Voodooshicage
Country: Bahrain
Language: English (Spanish)
Genre: Life
Published (Last): 18 January 2010
Pages: 88
PDF File Size: 9.16 Mb
ePub File Size: 19.54 Mb
ISBN: 682-7-52957-521-6
Downloads: 54607
Price: Free* [*Free Regsitration Required]
Uploader: Shabar

You have to use full path to the application you are trying to start. In order to use the function, you first need shellexecufe add the ShellApi to your uses clause, like: There isnt any ”file not found” message.

You should use fully-qualified paths.

It just nothing happens. This unit comes with Delphi installation it self.

Using Shell Execute in Delphi – Azulia Designs

When i want to relocate the launcher outside this folder i use this command: Syntax of Windows API function. Of course, you should never hard-code such a string, since it may be different on different systems.

Sign up or log in Sign up using Dhellexecute. Open an HTML page, local or remote: It gives some degree of control, and at the same time it’s not too complicated.


ShellExecute Handle, ‘open’, PChar ‘command. AndreasRejbrand Actually, ShellExecute is basically useless when it comes to reporting errors. EX – PChar filename. Launching an external program and waiting until it is terminated is quite de,phi story Use CreateProcess to create processes.

How to open my browser with a local HTML page? EXE file is invalid non-Win By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies. If your application launches your own company’s games, you have to figure out a clever way to communicate paths.

The active window remains active.

ExeName will give you full path to your launcher exe. Upon completion of the external application, the demo form is restored in its original state.

Using Shell Execute in Delphi

ShellExecute Handle, ‘explore’, PChar ‘c: Clicking the first button will launch the shellexefute application that is specified in the first edit-box. The simplest method is: We can tell if a process has completed by monitoring its process handle. That said, ShellExecute doesn’t report errors in a sane way and you should never use it. ShellExecute function documentation Most common error codes: ShellExecute Handle, ‘explore’, PChar ‘c: People have been asking me over and over: In this blog I have tried to cover all the ways.


I have made a Game Launcher and I use this command: EXE or error in. The last part of your comment suggests the issue is very specific to starter. If your application is a general application launcher, you get the path from the user.

There’s no point writing code that doesn’t deal with errors. We can delete comments later.

Always check for errors. If that program accepts one or more parameters, you can enter these in the second edit-box. Anyhow, what is the return value? Use ShellExecuteEx when you need to get the shell to work out how to resolve sheplexecute shell verb.