AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Problem beim Programmneustart mit Instanzkontrolle
Thema durchsuchen
Ansicht
Themen-Optionen

Problem beim Programmneustart mit Instanzkontrolle

Ein Thema von Opa Knack · begonnen am 7. Nov 2013 · letzter Beitrag vom 10. Nov 2013
 
hathor
(Gast)

n/a Beiträge
 
#15

AW: Problem beim Programmneustart mit Instanzkontrolle

  Alt 8. Nov 2013, 19:13
Das Problem "OneInstance" hatte ich heute auch und habe es im DPR-File gelöst.
Wenn das zuerst gestartete Programm minimiert ist, wird es angezeigt.
Funktioniert auch unter WIN 8.0.


Delphi-Quellcode:
program TEST1;

uses
  Forms, Windows,
  Unit1 in 'Unit1.pas{Form1};

{$R *.res}

procedure SwitchToThisWindow(h1: hWnd; x: bool); stdcall; external user32 Name
'SwitchToThisWindow'; {x = false: Size unchanged, x = true: normal size}

var
  PreviousHandle : THandle;
begin
  PreviousHandle := Windows.FindWindow(NIL,'MyProg'); //MyProg = Form1.caption
  if PreviousHandle = 0 then
  begin
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end
  else
 begin
    if Windows.IsIconic(PreviousHandle) then
        Windows.ShowWindow(PreviousHandle, SW_RESTORE);
    SwitchToThisWindow(PreviousHandle, TRUE);
    SetForegroundWindow(PreviousHandle);
    SetWindowPos(PreviousHandle,
      HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_SHOWWINDOW);
 end;
end.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:47 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz