隐藏和显示WINDOWS任务栏

procedure hideTaskbar;
var
  wndHandle : THandle;
  wndClass : array[0..50] of Char;
  //char数组保存任务栏类名
begin
  //StrPCopy(@wndClass[0], 'Shell_TrayWnd');
  wndHandle := FindWindow(PChar('Shell_TrayWnd'), nil);
  ShowWindow(wndHandle, SW_HIDE);
//将nCmdShow设为SW_HIDE来隐藏窗口
end;

procedure showTaskbar;
var
  wndHandle : THandle;
  wndClass : array[0..50] of Char;
begin
  StrPCopy(@wndClass[0], 'Shell_TrayWnd');
  wndHandle := FindWindow(@wndClass[0], nil);
  ShowWindow(wndHandle, SW_RESTORE);
//将nCmdShow设为SW_RESTORE来显示窗口
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  hideTaskbar;
  //调用hideTaskbar过程隐藏任务栏
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  showTaskbar;
//调用showTaskbar过程显示任务栏
end;

 

转载于:https://www.cnblogs.com/yoogoo/archive/2012/04/09/2439202.html

你可能感兴趣的:(隐藏和显示WINDOWS任务栏)