只要你有一台电脑或者手机,都能关注图老师为大家精心推荐的让窗体在执行了“显示桌面”以后仍旧显示在桌面上,手机电脑控们准备好了吗?一起看过来吧!
【 tulaoshi.com - 编程语言 】
昨天在DFW上看到一个问题,要求“使程序窗口置于最低层(在桌面上);点击“显示桌面”以后还是在桌面上”,琢磨了一下,实现了“让窗体在执行了‘显示桌面’以后仍旧显示在桌面上”,代码如下:
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)  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.....
来源:http://www.tulaoshi.com/n/20160219/1622321.html
看过《让窗体在执行了“显示桌面”以后仍旧显示在桌面上》的人还看了以下文章 更多>>