Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   ShutdownBlockReason ist weg aber doch noch da... (https://www.delphipraxis.net/158521-shutdownblockreason-ist-weg-aber-doch-noch-da.html)

Angel4585 21. Feb 2011 08:29

ShutdownBlockReason ist weg aber doch noch da...
 
Hallo,

in einer meiner Anwendungen arbeite ich mit ShutdownBlockReasonCreate bzw. ShutdownBlockReasonDestroy.
Nun hab ich das Problem, dass EIGENTLICH alles funktioniert.
Der Code wird sauber ausgeführt, ich bekomm in den Logfiles die Meldung, dass ShutdownBlockReasonDestroy sauber ausgeführt wurde, aber das System hängt trotzdem immernoch in diesem ShutdownBlock Bildschirm und zeigt mir meine Block-Nachricht an.

Hier der Code:
Delphi-Quellcode:
procedure TtfMain.UnblockShutdown;
var
LHandle: THandle;
begin        
logger.log('Unblock Shutdown',ltMust);
if FShutdownBlocked then
  begin
  if WindowsVersionInfo1.MajorVersion>=6 then
    begin
    LHandle:=GetModuleHandle(PChar('user32.dll'));
    try
      if LHandle = 0 then logger.Log('user32.dll kann nicht geladen werden. '+SysErrorMessage(GetLastError))
      else
        begin
        if ShutdownBlockReasonDestroy(Handle)then
          begin
          logger.log('ShutdownBlock wurde zerstoert',ltMust);
          FShutdownBlocked:=False;
          end
        else logger.log('ShutdownBlock konnte nicht zerstoert werden. '+SysErrorMessage(GetLastError),ltMust);
        end;
    finally
      FreeLibrary(LHandle);
    end;
    end
  else FShutdownBlocked:=False;
  end;
end;
Die Anwendung wird dann beendet. Jedenfalls ist sie beendet wenn ich bei dem Block-Bildschirm auf abbrechen gehe und damit zurückgehe.
Wie gesagt, obwohl die Funktion sauber ausgeführt und das Programm sogar beendet wird, bleibt die Nachricht stehen und das System fährt nicht fort mit runterfahren, was eigentlich geplant war.:(

Hat jemand ne Idee was da schiefgeht?
:angel:


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:53 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz