隱藏Windows的工具列和案頭表徵圖

來源:互聯網
上載者:User

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.