Difference between WinExec and ShellExecute

3

Good morning everyone!

I have a personal question that I have not yet found an answer to, so I come here.

What is the difference between WinExec and ShellExecute in Delphi?

I ask this question because recently I had a problem trying to use WinExec (I was trying to install a Windows service, but without success), but using ShellExecute , the service was installed normally.

What does one have that the other does not have? I used Delphi 2010.

    
asked by anonymous 16.11.2017 / 15:03

1 answer

3

The ShellExecute function works just like the Windows Run menu, and this is your best benefit to use, WinExec is already deprecated with the CreateProcess successor.

WinExec executes a simple statement from another application, an execmplo would open the Windows caculator by clicking on a button from within your application!

Since ShellExecute is much more complex, it operates on a "file", an example would be you ask to print a certain file from your application! I believe you could install the service with the correct command line!

Documentation WinExec

Some details on SOen

More relevant details here.

Edit:

Inside the IDE Help you can browse the Microsoft Windows Plataform SDK item and get more details about the ShellExecute , this is not a link to browsing, it is only within Help

    
16.11.2017 / 17:35