unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmMain = class(TForm)
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
procedure TfrmMain.CheckBox1Click(Sender: TObject);
var
wndHandle : THandle;
wndClass : array[0..50] of Char;
begin
StrPCopy(@wndClass[0], 'Shell_TrayWnd');
wndHandle := FindWindow(@wndClass[0], nil);
if self.CheckBox1.Checked then
begin
ShowWindow(wndHandle, SW_HIDE);
end
else
begin
ShowWindow(wndHandle, SW_RESTORE);
end;
end;
procedure TfrmMain.CheckBox2Click(Sender: TObject);
var
wndHandle : THandle;
wndClass : array[0..50] of Char;
begin
StrPCopy(@wndClass[0], 'Progman');
wndHandle := FindWindow(@wndClass[0], nil);
if self.CheckBox2.Checked then
begin
ShowWindow(wndHandle, SW_HIDE);
end
else
begin
ShowWindow(wndHandle, SW_RESTORE);
end;
end;
end.
FORM
object frmMain: TfrmMain
Left = 192
Top = 107
Width = 249
Height = 198
Caption = 'ShowWindow'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object CheckBox1: TCheckBox
Left = 40
Top = 48
Width = 145
Height = 25
Caption = #38544#34255'Windows'#30340#24037#20855#26639
TabOrder = 0
OnClick = CheckBox1Click
end
object CheckBox2: TCheckBox
Left = 40
Top = 88
Width = 153
Height = 33
Caption = #38544#34255'Windows'#30340#26700#38754#22270#26631
TabOrder = 1
OnClick = CheckBox2Click
end
end