delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks

unit CPower; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); private { Private declarations } procedure WMPowerBroadcast(var message: TMessage); message WM_POWERBROADCA ST; public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} { TForm1 } procedure TForm1.WMPowerBroadcast(var message: TMessage); const SkipNextPowerMsg:boolean=True; begin if SkipNextPowerMsg then begin SetForegroundWindow(Self.Handle); if Application.MessageBox('是否关闭系统?','警告',MB_OKCANCEL + MB_DEFBU TTON2)<>IDOK then begin message.Result := BROADCAST_QUERY_DENY; SkipNextPowerMsg:=not SkipNextPowerMsg; end else Close; end else SkipNextPowerMsg:=not SkipNextPowerMsg; end; procedure TForm1.FormPaint(Sender: TObject); begin Self.Visible:=False; end; end.

继续阅读《如何屏蔽一个按键》的全文内容...



--------------------------
新闻:鲍尔默:不解Google为何推出两款操作系统
网站导航: 博客园首页  新闻  .NET频道  社区  博问  闪存  找找看
posted on 2009-07-15 10:28 delphi2007 阅读(517) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。