I have a Delphi application that uses ShellExecute to call a second Delphi Application on a button press.
The applications are stored on the same server, on the same network share. Their paths are in the format:
const
JobManager = 'Z:\Apps\Application 1\Application1.exe';
FeeManager = 'Z:\Apps\Application 2\Application2.exe';
The call to ShellExecute is made as follows:
rh := FindWindow(PChar('TMF'), PChar('Edit Job Details'));
if rh = 0 then
begin
ShellExecute(Handle, 'open', JobManager, nil, nil, SW_SHOWNORMAL);
...
As we have three office we have copies of the Apps folder on each office server. Each server has the Apps folder on a share mapped to "Z:"
In one of the offices we have discovered a problem where the Applications cannot be found if the paths contain spaces. As the applications are straight copies of each other, and work in the other offices the problem seems to be a machine setting.
Any ideas?
With your lpFile
parameter you should cast JobManager
as PChar
:
ShellExecute(Handle, 'open', PChar(JobManager), nil, nil, SW_SHOWNORMAL);
Note that the open
verb parameter is also not needed, and you could pass nil
with the lpOperation
parameter (default).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With