I think there's no real need to cast the filename to PChar as Delphi should do that for you.
You're also being inconsistent as LPCTSTR lpOperation (2nd parameter) is also a PChar in Delphi.
Anyway, my first bet would be the working directory of the apps you're trying to launch.
ShellExecute(0,'open','D:\Games\Simbin\GTR2\GTR2.exe',nil,'D:\Games\Simbin\GTR2\', SW_SHOWNORMAL);
Grab the Shellexecute return code in an
int and check if it is other than 32.
If it is, then look up the error number or compare it to
ERROR_FILE_NOT_FOUND
ERROR_PATH_NOT_FOUND
ERROR_BAD_FORMAT
SE_ERR_ACCESSDENIED
SE_ERR_ASSOCINCOMPLETE
SE_ERR_DDEBUSY
SE_ERR_DDEFAIL
SE_ERR_DDETIMEOUT
SE_ERR_DLLNOTFOUND
SE_ERR_FNF
SE_ERR_NOASSOC
SE_ERR_OOM
SE_ERR_PNF
SE_ERR_SHARE
To see why it is failing
I'd rather have a bottle in front of me than a frontal lobotomyEdited 1 time(s). Last edit at 11/13/2006 02:06AM by ZaZ.