如何使应用程序最小化

zr3636 2004-12-31 07:24:35
Delphi中第一个创建的窗口最小化时,整个应用程序最小化.

如何使得其它窗口最小化时,整个应用程序也随之最小化?
...全文
135 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zr3636 2005-01-04
  • 打赏
  • 举报
回复
Kevin_Lmx(繁华阅尽)

立竿见影,谢谢.
Kshape 2005-01-03
  • 打赏
  • 举报
回复
procedure TForm2.WndProc(var message: TMessage);
begin
if (message.Msg=WM_SYSCOMMAND) and (message.WParam=SC_MINIMIZE) then
Application.Minimize;
inherited;
end;
kuki84 2005-01-03
  • 打赏
  • 举报
回复
。。。。。
fengxue291080 2005-01-02
  • 打赏
  • 举报
回复
来晚了

就是上面的
raineyquanter 2005-01-02
  • 打赏
  • 举报
回复
Kevin_Lmx(繁华阅尽) 说的完全正确,截获第一个窗体最小化消息的时候将整个应用程序最小化就行了!
Kevin_Lmx 2004-12-31
  • 打赏
  • 举报
回复
截获WM_SYSCOMMAND的消息。
例子:
//(Form1)
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
end;

end.
------------------------------
//(form2)
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
procedure WndProc(var message:TMessage);Override;
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

{ TForm2 }

procedure TForm2.WndProc(var message: TMessage);
begin
if (message.Msg=WM_SYSCOMMAND) and (message.WParam=SC_MINIMIZE) then
Application.Minimize;
inherited;
end;

end.

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧