Hallo zusammen,
zu diesem Problem habe ich die Lösung von Hagen genutzt:
function AtomExists: Boolean;
function DoActivate(Wnd: hWnd; Atom: PChar): Bool; stdcall;
var
Focus: HWnd;
begin
Focus := GetProp(Wnd, Atom);
if IsWindow(Focus) then
begin
Result := False;
if IsIconic(Focus) then SendMessage(Focus, wm_SysCommand, sc_Restore, 0);
SetForegroundWindow(Focus);
end
else
Result := True;
end;
var
Atom: THandle;
begin
Atom := GlobalFindAtom(PChar(ParamStr(0)));
Result := Atom <> 0;
if Result then
EnumWindows(@DoActivate, Atom);
end;
begin
if not AtomExists then
try
Atom := GlobalAddAtom(PChar(ParamStr(0)));
Application.Initialize;
...
Wie kann man das Problem beheben, wenn in der Entwicklungsumgebung mit STRG F2 das Programm abgebrochen wird?
Dann wird das Atom nicht mehr entfernt.
Danke für eine Info
Gruß
Holger
zu diesem Problem habe ich die Lösung von Hagen genutzt:
function AtomExists: Boolean;
function DoActivate(Wnd: hWnd; Atom: PChar): Bool; stdcall;
var
Focus: HWnd;
begin
Focus := GetProp(Wnd, Atom);
if IsWindow(Focus) then
begin
Result := False;
if IsIconic(Focus) then SendMessage(Focus, wm_SysCommand, sc_Restore, 0);
SetForegroundWindow(Focus);
end
else
Result := True;
end;
var
Atom: THandle;
begin
Atom := GlobalFindAtom(PChar(ParamStr(0)));
Result := Atom <> 0;
if Result then
EnumWindows(@DoActivate, Atom);
end;
begin
if not AtomExists then
try
Atom := GlobalAddAtom(PChar(ParamStr(0)));
Application.Initialize;
...
Wie kann man das Problem beheben, wenn in der Entwicklungsumgebung mit STRG F2 das Programm abgebrochen wird?
Dann wird das Atom nicht mehr entfernt.
Danke für eine Info
Gruß
Holger
Comment