Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Feststellen ob Anwendung die VCL verwendet (https://www.delphipraxis.net/151791-feststellen-ob-anwendung-die-vcl-verwendet.html)

igel457 1. Jun 2010 21:21

Re: Feststellen ob Anwendung die VCL verwendet
 
Zitat:

Zitat von himitsu
Eine zündene Idee, wie der Anwender doch mithilft.
PS: Nur weil die VCL eingebunden ist, muß sie bei den Events dennoch keine Rolle spielen.

Bau doch einfach ein Feld/Property in deiner Komponente ein, wo man den SyncMode wählen kann.
(per Standard auf VCL-Synchronize ... sicher ist sicher, falls man das Setzen vergist)

Habe ich (mehr oder weniger)... Ist zwar keine Komponente, aber man kann einfach mittels folgender Funktionen...
Delphi-Quellcode:
{Allows you to set an own instance of a notification processor. This method has to be called before any other notification system procedure has been used.
@seealso(TAcNotifyProcessor)}
procedure AcNotifyManualSetProcessor(ANotifyProcessor: TAcNotifyProcessor);
{If you've initialized the notification queue system using the AcNotifyManualInit function, you must use this function to synchronize the notifications with the thread calling AcNotifyManualProcessQueue.
@seealso(AcNotifyManualInit)}
procedure AcNotifyManualProcessQueue;
{Initializes the notification system with TAcManualNotifyProcessor, allowing you to use the AcNotifyManualProcessQueue function.
@seealso(AcNotifyManualProcessQueue)}
procedure AcNotifyManualInit;
...beim Programmstart einen eigenen Prozessor für die Events festlegen oder auf den oben beschriebenen manuellen Modus umschalten. Macht man gar nichts wird bei der ersten Verwendung der Notify-Funktionalität der Standard ausgewählt. Entweder der TAcVCLNotifyProzessor oder eben der TAcNonVCLNotifyProcessor.

Ich möchte eben nur irgendwie automatisch den Standardprozessor setzen...

Namenloser 1. Jun 2010 22:10

Re: Feststellen ob Anwendung die VCL verwendet
 
Also letztlich geht es ja um die Synchronize-Methode, oder? Wäre es da nicht u.U. einfacher zu prüfen, ob die "Maschinerie", die den internen Synchronize-Queue abarbeitet, existiert, als zu prüfen, ob die VCL eingebunden wurde? Ich habe da beim Überfliegen der Synchronisations-methoden in der Unit Classes den globalen Funktionszeiger "WakeMainThread" gefunden. Auf den ersten Blick scheint er ein ganz gutes Indiz zu sein:
Delphi-Quellcode:
if Assigned(WakeMainThread) then
   // VCL
else
  // NonVCL
Ich habe es nur kurz anhand einer neu erstellten VCL-Applikation bzw. einer leeren Konsolenapplikation getestet, dort lieferte der Test aber jedenfalls das korrekte Ergebnis.

igel457 2. Jun 2010 21:28

Re: Feststellen ob Anwendung die VCL verwendet
 
Hallo,

dein Code funktioniert - auch mit Lazarus wird korrekt auf das vorhandensein der LCL (bzw. eines Handlers für Synchronize, was in der Tat das ist, was ich eigentlich möchte) hingewiesen. :thumb:

Vielen Dank,
Andreas


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:28 Uhr.
Seite 2 von 2     12   

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