Code: Select all
ShowWindow(wnd, SW_SHOWNORMAL);
SetForegroundWindow(wnd);
As I understand it - the process needs to be resumed from the suspended state before it can be brought to the foreground, so I first tried to resume the process as a whole (pid is the process ID):
Code: Select all
processList := Processes();
for processIndex := 0 to processList.ItemCount - 1 do begin
processItem := processList.Items[processIndex];
if processItem.ID = pid then
processItem.Resume;
end;
end;
Code: Select all
processList := Processes();
for processIndex := 0 to processList.ItemCount - 1 do begin
processItem := processList.Items[processIndex];
if processItem.ID = pid then begin
threadList := processItem.Threads;
for threadIndex := 0 to threadList.ItemCount - 1 do begin
threadItem := threadList.Items[threadIndex];
if threadItem.IsSuspended then
threadItem.Resume();
end;
processItem.Resume;
end;
end;