CreateProcess problem?
Trying to make Games Explorer here, functionally similar to one in Vista/7 (that, honestly, fails to serve it's purpose most of the time)
I'm using CreateProcess() to launch the game executable (or anything else for that matter).
Most games work this way. One does not. When it's run from Windows Explorer (e.g., directly or using a shortcut), everything is ok.
When run from my program, using the code above, it crashes.
Could it be that my CreateProcess code is wrong?
I'm using CreateProcess() to launch the game executable (or anything else for that matter).
- Code: Select all
function LaunchTarget(Target: string): BOOL;
var
SI: TStartupInfo;
PI: TProcessInformation;
begin
ZeroMemory(@SI, SizeOf(SI));
SI.cb := SizeOf(SI);
ZeroMemory(@PI, SizeOf(PI));
Result := CreateProcess(nil, PChar(Target), nil, nil, false, 0, nil, PChar(ExtractFilePath(Target)), SI, PI);
end;
Most games work this way. One does not. When it's run from Windows Explorer (e.g., directly or using a shortcut), everything is ok.
When run from my program, using the code above, it crashes.
Could it be that my CreateProcess code is wrong?