【问题标题】:Minimizing application following Windows Show desktop command when modal form is opened打开模态表单时,最小化 Windows Show desktop 命令后的应用程序
【发布时间】:2015-07-30 06:23:19
【问题描述】:

我有一个多表单应用程序并使用 ShowModal 打开我的一个表单。当 Windows 中的 Show Desktop 命令被调用时,有没有办法最小化整个应用程序?

附:德尔福 2009,赢 7

我的代码:

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.ShowModal;
end;

end.

unit Unit2;

interface

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

type
  TForm2 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

end.

DPR:

program Project1;

uses
  ExceptionLog,
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.

【问题讨论】:

  • 这肯定会自动发生。我知道我的应用程序在显示桌面时表现良好。你的有什么特别之处。请给我一个 MCVE。
  • 重新表述了我的问题。不得不说我最上面的形式是模态的。
  • 应该没关系。我没有这样的问题。为什么没有 MCVE?
  • 添加了我的源代码。
  • 我刚刚在 D2007 和 Win 8.1 上尝试过它的行为,无论是否按下按钮。也许你的窗户本身有问题。

标签: delphi modal-dialog delphi-2009


【解决方案1】:

我刚刚在 D2007 和 Win 8.1 上尝试过它的行为,无论是否按下按钮。也许你的窗户本身有问题。我注意到您在 dpr 文件中有 uses ExceptionLog。 - 这就是罪魁祸首。

【讨论】:

  • ExceptionLog 由 Eureka Log 实用程序在激活时添加。我禁用了它,它从使用中删除了文件,但不幸的是程序行为没有改变。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多