昨天在DFW上看到一个问题,要求“使程序窗口置于最低层(在桌面上);点击“显示桌面”以后还是在桌面上”,琢磨了一下,实现了“让窗体在执行了‘显示桌面’以后仍旧显示在桌面上”,代码如下: unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms;
type TForm1 = class(TForm) private { Private declarations } procedure WndProc(var Message: TMessage); override; // 重载 public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WndProc(var Message: TMessage); var WndPosFlag: Integer; begin if Message.Msg = WM_SHOWWINDOW then begin if Message.WParam = 0 then begin Exit; end; end; inherited; end;
end. 可是。。。。。。有个前提:窗体属性 FormStyle = fsStayOnTop 这个不可省。。。所以不能呆在所有窗体最后 spy++跟了半天,还是没想明白为什么FormStyle属性为fxNormal的时候WM_SHOWWINDOW消息在程序里就截不到。。。而断点调试时能截到第一次,后面也再截不到了,神奇 不管FormStyle为什么程序明明都收到了WM_SHOWWINDOW消息的(而且消息值也都相同) 汗ing..... 
|