午
午夜棍子
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
==========================================================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
[red]procedure OnWindowsEixt(var msg:Tmessage);message WM_QUERYENDSESSION;[/red]
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.OnWindowsEixt(var msg: Tmessage);
begin
[red]msg.result := 0;[/red]
ShowMessage('禁止关机');
end;
end.
=========================================================
为什么用这段代码禁止关机没用呢?
点击“开始”->“关闭计算机”->“关闭”后,仍然会关机。
==========================================================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
[red]procedure OnWindowsEixt(var msg:Tmessage);message WM_QUERYENDSESSION;[/red]
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.OnWindowsEixt(var msg: Tmessage);
begin
[red]msg.result := 0;[/red]
ShowMessage('禁止关机');
end;
end.
=========================================================
为什么用这段代码禁止关机没用呢?
点击“开始”->“关闭计算机”->“关闭”后,仍然会关机。