如何对窗口右上角的3个按钮即最大化,最小化,关闭的操作进行拦截并操作。
解决方案 »
- fastreport导出pdf时出现错误,请高手解决,急
- treeview 应用的问题,查找的 问题?
- 如何创建IE工具条,请高手指点下面的代码?
- 本人对于读写锁上的理解,大家有疑问的可以过来看看,或许有帮助
- 问个简单的文件读写方法,用偏移量读.
- MDI子窗体释放的问题
- 请问怎样在程序中调用winzip?
- 怎么在delphi里调用其他程序?
- SQL语句 小问题
- 如何自定义控件,当TEdit,TComboBox等的BorderStyle设为bsNone时,能自定义边框。
- 组件安装,急
- 超难度!!!如何用程序登录网络(局域网)上其他Win2000计算机(guest是设置密码了的,并且也知道它的密码)
begin
inherited; //如果你要废弃原有操作,这句不加
case Msg.wParam of
SC_MINIMIZE: ; //当点了最小化按钮
SC_MAXIMIZE: ; //当点了最大化按钮
SC_RESTORE: ; //当点了恢复按钮
SC_CLOSE: ; //当点了关闭按钮
end;
end;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMSYSCOMMAND (var Message : TWMSYSCOMMAND); message WM_SYSCOMMAND;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
procedure TForm1.WMSYSCOMMAND (var Message : TWMSYSCOMMAND);
begin
case Message.CmdType of
SC_MAXIMIZE : showmessage('You click Max button');
SC_MINIMIZE : showmessage('You click Min button');
SC_RESTORE : showmessage('You click Restore button');
SC_CLOSE : showmessage('You click Close button');
end;
inherited;
end;
procedure TCustomForm.WMSysCommand(var Message: TWMSysCommand);
begin
with Message do
begin
if (CmdType and $FFF0 = SC_MINIMIZE) and (Application.MainForm = Self) then
Application.WndProc(TMessage(Message))
else if (CmdType and $FFF0 <> SC_MOVE) or (csDesigning in ComponentState) or
(Align = alNone) or (WindowState = wsMinimized) then
inherited;
if ((CmdType and $FFF0 = SC_MINIMIZE) or (CmdType and $FFF0 = SC_RESTORE)) and
not (csDesigning in ComponentState) and (Align <> alNone) then
RequestAlign;
end;
end;
{ Private declarations }
procedure MySyscommand(var Msg: TWMSYSCOMMAND);message WM_SYSCOMMAND;
procedure TForm1.MySyscommand(var Msg: TWMSYSCOMMAND);
begin case (Msg.CmdType and $fff0) of
SC_CLOSE: showmessage('close');
SC_MAXIMIZE: showmessage('maximize');
SC_MINIMIZE: showmessage('minimize');
end;
end;