- 帖子
- 58
- 积分
- 170
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2009-12-26
|
又发现了两段隐藏桌面图标和任务栏的代码,但我不懂,给大家参考。
第一段:
--------------------------------------------------------------------------------
ShowWindow (FindWindow("Shell_TrayWnd",0),SW_HIDE);//隐藏桌面
ShowWindow (FindWindow("Progman",0),SW_HIDE);//隐藏任务栏
--------------------------------------------------------------------------------
第二段:
--------------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{初始化}
procedure TForm1.FormCreate(Sender: TObject);
begin
CheckBox1.Caption := '隐藏桌面图标';
CheckBox2.Caption := '隐藏任务栏';
end;
{隐藏或显示桌面图标}
procedure TForm1.CheckBox1Click(Sender: TObject);
var
h: HWND;
begin
h := FindWindow('Progman', nil); {Progman 是桌面窗口的类名}
if TCheckBox(Sender).Checked then
ShowWindow(h, SW_HIDE)
else
ShowWindow(h, SW_RESTORE);
end;
{隐藏或显示任务栏}
procedure TForm1.CheckBox2Click(Sender: TObject);
var
h: HWND;
begin
h := FindWindow('Shell_TrayWnd', nil); {Shell_TrayWnd 是任务栏窗口的类名}
if TCheckBox(Sender).Checked then
ShowWindow(h, SW_HIDE)
else
ShowWindow(h, SW_RESTORE);
end;
end.
--------------------------------------------------------------------------------
再补充一下,修改注册表隐藏桌面要重启电脑,此法不好!
[ 本帖最后由 lujice 于 2010-2-2 14:50 编辑 ] |
|