AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Konsolenanwendung Programmende abfragen

Ein Thema von knochen · begonnen am 20. Dez 2023 · letzter Beitrag vom 21. Dez 2023
 
Kas Ob.

Registriert seit: 3. Sep 2023
457 Beiträge
 
#4

AW: Konsolenanwendung Programmende abfragen

  Alt 20. Dez 2023, 16:50
Application ist aber in der Unit Forms deklariert. Kann ich das trotzdem verwenden, indem ich forms.pas einbinde oder gibt es eine Entsprechung bei Konsolenanwendungen?
Yes you can add Forms to console application, but it is not enough and will not solve your problem as himitsu said, you should capture the signals instead, this is cleaner and the right way with consoles.

To capture these events you need to use SetConsoleCtrlHandler
https://learn.microsoft.com/en-us/wi...olectrlhandler
https://learn.microsoft.com/en-us/wi...handlerroutine
Something like this :
Code:
function HandlerRoutine(dwCtrlType: DWORD): Bool; stdcall;
begin
  Result := false;
  if (CTRL_C_EVENT = dwCtrlType) or (CTRL_BREAK_EVENT = dwCtrlType) then
  begin

    Result := true;
  end;
end;

// setup the callback routine
SetConsoleCtrlHandler(@HandlerRoutine, True);
Kas
  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 01:54 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