This is the code we use to manage our two executables. To get the class name for the application, you can use the Code-insight tool that comes with delphi. If the application you want to manage is written in delphi, the class name will be TApplication. The window name (ASTR_MainFormWindowName), is typically the caption on your main form at the time delphi creates it. You do not need both parameters, but if you have more than one delphi application running, TApplication may not find the one you want without the second parameter.
I hope this helps.
function OpenPreviousInstance (ASTR_ApplicationClassName, ASTR_MainFormWindowName:string):boolean;
//Either parameter can be nil. You only need one in most cases.
var
AppHandle : THandle;
begin
result := false;
AppHandle := FindWindow (PChar (ASTR_ApplicationClassName) , Pchar(ASTR_MainFormWindowName));
if AppHandle <> 0 then
begin
if IsIconic(AppHandle) then
ShowWindow(AppHandle,SW_Restore)
else
BringWindowToTop(AppHandle);
SetForegroundWindow(AppHandle);
CloseHandle(AppHandle);
result := true;
exit;
end;
CloseHandle(AppHandle);
end;