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: Febar Nelmaran
Country: Czech Republic
Language: English (Spanish)
Genre: Environment
Published (Last): 4 February 2015
Pages: 435
PDF File Size: 19.3 Mb
ePub File Size: 8.76 Mb
ISBN: 666-6-69700-954-3
Downloads: 20263
Price: Free* [*Free Regsitration Required]
Uploader: Guzuru

In order to use the function, you first need to add the ShellApi to your uses clause, like: I wrapped it all up in a ready-to-go demo project see picture abovewhich demonstrates the use of the functions discussed above.

ShellExecute in Delphi

ShellExecute Handle, ‘explore’, PChar ‘c: By using ShellExecute we can also do following operations We can delete comments later. Post as a guest Name. ShellExecute Handle, ‘open’, PChar ‘http: Always check for errors.

Today in most of software program it is required to send mail to others with attached data. ShellExecute Handle, ‘open’, PChar ‘http: We visualized this by hiding the three group boxes, thereby hiding all the controls of the form. Why would you give up so easily? You have to use full path to the application you are trying to start. There was not enough memory to complete the operation.

Running external applications: ShellExecute and ShellExecuteEx

Try passing the executable’s directory in the lpDirectory parameter to ShellExecute. You link to an irrelevant set of error codes. If you have to resolve shell verbs, use ShellExecuteEx which does have proper error reporting.


What happens next, depends from the state of the “Wait for termination” checkbox: Delphi 7 – ShellExecute command not working in situations Ask Question. Never ever call it. When i want to relocate the launcher outside this folder i use this command:. Sometime we need some shellxecute directories path from Microsoft Windows system to store User data or to copy some files etc. I have collected some of ways which are very useful for Delphi developers. ShellExecute Handle, ‘open’, PChar ‘command.

There isnt any ”file not found” message. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms sheolexecute serviceprivacy policy and cookie policyand that shellexfcute continued use of the website is subject to these policies.

The simplest method is: If your application launches your own company’s games, you have to figure out a clever way to communicate paths. David I added CreateProcess too. Note the added extra touch: How to open my browser with a local HTML page? In Delphi we don’t required any third party components to send mails. ShellExecuteEx is your guy.

EXE file is invalid non-Win Can you be more specific please? These do not apply to ShellExecute. There’s no point writing code that doesn’t deal with errors.

The last part of your comment suggests the issue is very specific to starter. ShellExecute Delphu, ‘explore’, PChar ‘c: What happens next, depends from the state of the “Wait for termination” checkbox:. ShellExecute Handle, ‘open’, PChar ‘command. Sign up using Facebook. I can’t imagine why you neglected this.


Also, I did address the issue of finding the absolute path. It gives some degree shhellexecute control, and at the same time it’s not too complicated. Also the title bar changes to “Waiting for completion of So we can get those folder paths in Delphi in several ways. The ‘return value’ is the value returned by the function. Clicking the first button will launch the external application that is specified in the first edit-box.

But I didn’t say so, either. ShellExecute in Delphi — Launch external applications. Upon completion of the external application, the demo form is restored in its original state. When i want dflphi relocate the launcher outside this folder i use this command: However, in this scenario it is CreateProcess that is needed.

If i use the xelphi i wrote in my question without the parameter -lang rus- The application starts normally even if i put the Launcher outside the ”bin” folder with this comand: