I have two applications everyone do different tasks, the first application runs the second one using shellExecute
.
ShellExecute(Handle, nil, PChar('D:\Project2.exe'), nil, nil, SW_SHOWNORMAL);
ShellExecute(Handle, nil, PChar('cmd.exe'), PChar('/C D:\Project2.exe'), nil, SW_SHOWNORMAL);
the second application extracts resources that already exist inside it.
The problem is : When I run the second application from the first application the resources doesn't extracted Although the application form show to me , but If I run the second directly "double-click" the resources extracted !
I also tried CreateProcess
and WinExec
, and the resource doesn't extracted too !!
Edit: the project1 have a button only open project2
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle, nil, PChar('D:\Project2.exe'), nil, nil, SW_SHOWNORMAL);
end;
this is project2 code , in the create section the resources must be extracted !
procedure TForm1.FormCreate(Sender: TObject);
var
DllRS: TResourceStream;
begin
DllRS:= TResourceStream.Create(HInstance, 'dllFile', 'dll');
try
DllRS.SaveToFile(GetCurrentDir + '\dllFile.dll');
finally
DllRS.Free;
end;
end;