P
P
Porto_b2020-04-28 16:03:19
Delphi
Porto_b, 2020-04-28 16:03:19

Delphi ShellExecute?

In general, the main application launches the Project1.exe program that is located in the control folder using the method:

...
ShellExecute(Handle, 'open', 'control\Project1.exe', nil, nil, SW_HIDE);
...

In turn, Project1.exe is written to open a file that is located in the same place as it is.

If you run the Project1.exe application directly, then everything works. Well, if you run it from the main application, which is higher than the level, then an error occurs (does not find the file).

You can get by in Project1.exe by writing an absolute path relative to the main application control/file.txt but is this correct? Again, if you run it directly, then naturally it will not find it. An absolute path relative to disks is also not an option.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
Hemul GM, 2020-04-28
@Porto_b

You need to specify the working directory when starting with shellexecute

I
Igor, 2020-04-28
@IgorPI

IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'относительный путь до файла'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question