I have a Delphi program where you select a program - ie Calculator, Notepad etc.
A 'Start' button launches the program you selected (let's say it's Calculator).
When you click on the 'Stop' button which closes the Calculator.
This needs to work regardless of the program chosen by the user.
At first, I thought this would be fairly straight forward.
Using ShellExecute the external program launches fine. The problem is stopping it from running.
There's also PostMessage for closing an application, but when you launch a program with ShellExecute there doesn't seem to be any way of finding out what handle the app is using for the PostMessage function.
Anyone give me some pointers on what I'm doing wrong please or suggest an alternative method?
TBaz
A 'Start' button launches the program you selected (let's say it's Calculator).
When you click on the 'Stop' button which closes the Calculator.
This needs to work regardless of the program chosen by the user.
At first, I thought this would be fairly straight forward.
Using ShellExecute the external program launches fine. The problem is stopping it from running.
There's also PostMessage for closing an application, but when you launch a program with ShellExecute there doesn't seem to be any way of finding out what handle the app is using for the PostMessage function.
Anyone give me some pointers on what I'm doing wrong please or suggest an alternative method?
TBaz