任务栏。桌面的隐藏

作者在 2010-01-25 17:14:17 发布以下内容
unit MainUnit;

interface

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

type
  TMainForm = class(TForm)
    RadioGroup1: TRadioGroup;
    RadioGroup2: TRadioGroup;
    RadioGroup3: TRadioGroup;
    RadioGroup4: TRadioGroup;
    procedure RadioGroup1Click(Sender: TObject);
    procedure RadioGroup2Click(Sender: TObject);
    procedure RadioGroup3Click(Sender: TObject);
    procedure RadioGroup4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.DFM}

procedure TMainForm.RadioGroup1Click(Sender: TObject);
var
  hTask: THandle;
begin
  hTask:= FindWindow('Shell_TrayWnd', nil);
  if RadioGroup1.ItemIndex= 0 then
    ShowWindow(hTask, SW_HIDE)
  else
    ShowWindow(hTask, SW_SHOW);
end;

procedure TMainForm.RadioGroup2Click(Sender: TObject);
var
  hDesktop: THandle;
begin
  hDesktop:= FindWindow('ProgMan', nil);
  if RadioGroup2.ItemIndex= 0 then
    ShowWindow(hDesktop, SW_HIDE)
  else
    ShowWindow(hDesktop, SW_SHOW);
end;

procedure TMainForm.RadioGroup3Click(Sender: TObject);
var
  hTask, hButton: THandle;
begin
  hTask:= FindWindow('Shell_Traywnd', nil);
  hButton:= FindWindowEx(hTask, 0, 'Button', nil);
  if RadioGroup3.ItemIndex= 0 then
    ShowWindow(hButton, SW_HIDE)
  else 
    ShowWindow(hButton, SW_SHOW);
end;

procedure TMainForm.RadioGroup4Click(Sender: TObject);
var
  hTask, hTIcon: THandle;
begin
  hTask:= FindWindow('Shell_Traywnd', nil);
  hTIcon:= FindWindowEx(hTask, 0, 'ReBarWindow32', nil);
  if RadioGroup4.ItemIndex= 0 then
    ShowWindow(hTIcon, SW_HIDE)
  else
    ShowWindow(hTIcon, SW_SHOW);
end;

end.

编程点滴 | 阅读 1470 次
文章评论,共0条
游客请输入验证码
浏览2354406次