Preventing Windows shut down

前端 未结 7 628
梦毁少年i
梦毁少年i 2021-01-18 09:14

To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below:

TForm3 = class(TForm)
priva         


        
7条回答
  •  無奈伤痛
    2021-01-18 09:34

    In all versions should you not be using the FormCloseQuery event?

    procedure TForm3.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      Canclose := Not StillDoingImportantStuff;
    end;
    

    Oops - just read comments to "this does not work" :( Is win 7 different?

    In all my apps this gets called if windows is trying to shut down...

提交回复
热议问题