Delphi中隐藏任务栏和桌面图标

1.隐藏任务栏

如下图所示建立工程:

代码如下:

unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var wndHandle : THandle; wndClass : array[0..50] of Char; begin StrPCopy(@wndClass[0], 'Shell_TrayWnd'); wndHandle := FindWindow(@wndClass[0], nil); ShowWindow(wndHandle, SW_HIDE); end; procedure TForm1.Button2Click(Sender: TObject); var wndHandle : THandle; wndClass : array[0..50] of Char; begin StrPCopy(@wndClass[0], 'Shell_TrayWnd'); wndHandle := FindWindow(@wndClass[0], nil); ShowWindow(wndHandle, SW_RESTORE); end; end. 

 

 

2.隐藏桌面图标

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var hDesktop : THandle; begin hDesktop := FindWindow('Progman', nil); ShowWindow(hDesktop, SW_HIDE); //隐藏桌面图标 end; procedure TForm1.Button2Click(Sender: TObject); var hDesktop : THandle; begin hDesktop := FindWindow('Progman', nil); ShowWindow(hDesktop, SW_SHOW); //显示桌面图标 end; end. 

你可能感兴趣的:(Delphi未了情)