mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #140: Store application process id in each tabs.ini section, and don't restore tabs from other running processes. If the process no longer runs, restore such tab sections again, so nothing gets lost with multiple running application instances.
This commit is contained in:
@ -359,6 +359,7 @@ type
|
||||
function DpiScaleFactor(Form: TForm): Double;
|
||||
function GetThemeColor(Color: TColor): TColor;
|
||||
function ThemeIsDark(ThemeName: String): Boolean;
|
||||
function ProcessExists(pid: Cardinal): Boolean;
|
||||
|
||||
var
|
||||
AppSettings: TAppSettings;
|
||||
@ -3010,6 +3011,26 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function ProcessExists(pid: Cardinal): Boolean;
|
||||
var
|
||||
Proc: TProcessEntry32;
|
||||
SnapShot: THandle;
|
||||
ContinueLoop: Boolean;
|
||||
begin
|
||||
// Check if a given process id exists
|
||||
SnapShot := CreateToolhelp32Snapshot(TH32CS_SnapProcess, 0);
|
||||
Proc.dwSize := Sizeof(Proc);
|
||||
Result := False;
|
||||
ContinueLoop := Process32First(SnapShot, Proc);
|
||||
while ContinueLoop do begin
|
||||
Result := Proc.th32ProcessID = pid;
|
||||
if Result then
|
||||
Break;
|
||||
ContinueLoop := Process32Next(SnapShot, Proc);
|
||||
end;
|
||||
CloseHandle(Snapshot);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{ Threading stuff }
|
||||
|
Reference in New Issue
Block a user