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: Shajind JoJolrajas
Country: Chile
Language: English (Spanish)
Genre: Business
Published (Last): 15 May 2005
Pages: 417
PDF File Size: 6.66 Mb
ePub File Size: 4.23 Mb
ISBN: 882-9-17728-811-3
Downloads: 44524
Price: Free* [*Free Regsitration Required]
Uploader: Kagahn

Using Shell Execute in Delphi – Azulia Designs

Today in most of software program it is required to send mail to others with attached data. What should i change? So what it LCID? ShellExecute Handle, ‘open’, PChar ‘c: Try passing the executable’s directory in the lpDirectory parameter to ShellExecute. Stack Overflow works best with JavaScript enabled.

If the checkbox is checked, the demo will wait for the completion selphi the external program.

You have to use full path to the application you are trying to start. Of course, you have read the ShellExecute documentation carefully, so you know what the return values are.

Running external applications: ShellExecute and ShellExecuteEx

It gives some degree of control, and at the same time it’s not too complicated. Did you try starter. By using ShellExecute we can also do following operations Sometime we need some special directories path from Microsoft Windows system to store User data or to copy some files etc.


Clicking the first button will launch the external application that is specified in the first edit-box. By the way, you could have figured all this out by shrllexecute by looking at the return value of ShellExecute. Can you be more specific please? How to open my browser with a local HTML page?

Also i cannot have a full path bc ”C: Handle looks dubious at best. As some time we need to update clients about their account details, status or any other information through mail. Of course, you should never hard-code such a string, since it may be different on different systems.

There was not enough memory to complete the operation. That process handle can be obtained by using one of two Win32 API-functions to start the external program: AndreasRejbrand Actually, ShellExecute is basically useless when it comes to reporting errors.

Also, I did address the issue of finding the absolute path. ShellExecute function documentation Most common error codes: Dlephi have collected some of ways which are very useful for Delphi developers. Syntax of Windows API function.


Different ways of executing applications and files from Delphi

ShellExecuteEx is your guy. In order to use the function, you first need to add the ShellApi to your uses clause, like: I have made a Game Launcher and I use this command: Ehellexecute simplest method is: The ‘return value’ is the value returned by the function. TObject ; var ExecuteResult: If i use the code 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: These do not apply to ShellExecute.

So here are the ways Can I print documents from within my program, without explicitly starting the application that created the document, such as: First use Excel unit to uses clause.

Use CreateProcess to create processes. In Delphi we don’t required any third party components to send mails. You can get the unit in installed path C: The last part of your comment suggests the issue is very specific to starter.