请问如何将任务栏设成自动隐藏.
修改注册表还是用api

解决方案 »

  1.   

    var 
      WndHandle: THandle; //用于存储指定窗口的句柄 
      WndClass: array[0..50] of Char; //用于存储类名 
    begin 
      StrPCopy(@WndClass[0], 'Shell_TrayWnd'); //获取任务栏类名 
      WndHandle := FindWindow(@WndClass[0],Nil); //获取任务栏窗口的句柄 
      ShowWindow(WndHandle, SW_Hide); //隐藏Windows任务栏 
    end;
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, Buttons, ComCtrls;type
      TForm1 = class(TForm)
        SpeedButton1: TSpeedButton;
        Image1: TImage;
        Memo1: TMemo;
        Timer1: TTimer;
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;  procedure SetTaskBarShowState(AShowState:Integer);var
      Form1: TForm1;implementationprocedure SetTaskBarShowState(AShowState:Integer);
    var
      WndHandle:THandle;
      WndClass:Array[0..50] of Char;
    begin
      StrPCopy(@WndClass[0],'Shell_TrayWnd');
      WndHandle:=FindWindow(@WndClass[0],Nil);
      ShowWindow(WndHandle,AShowState);
    end;{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      Self.Caption :=IntToStr(Mouse.CursorPos.Y)+':'+IntToStr(Screen.WorkAreaHeight);
      if Mouse.CursorPos.Y>Screen.WorkAreaHeight then//SystemParametersInfo(SPI_GETWORKAREA,0,Nil,0) then
        SetTaskBarShowState(SW_SHOW)
      else
        SetTaskBarShowState(SW_HIDE);
    end;end.刚写的,完全可以实现你要的功能!
      

  3.   

    Screen.WorkAreaHeight 提示找不到!
      

  4.   

    哥们啊,你自己好好调试调试吧,偶那个代码是在我机器上运行过以后才贴上来的!你要还说有错误,偶可真是没有折子了!Screen是全局变量,为TSreen类型,这个类型是在单元Forms中申明的,后面的WorkAreaHeight是它的属性,表示工作区(去掉任务栏后)的高度!自己再试试吧!
      

  5.   

    fs  的代码整理如下
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, Buttons, ComCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;    procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;  procedure SetTaskBarShowState(AShowState:Integer);var
      Form1: TForm1;implementationprocedure SetTaskBarShowState(AShowState:Integer);
    var
      WndHandle:THandle;
      WndClass:Array[0..50] of Char;
    begin
      StrPCopy(@WndClass[0],'Shell_TrayWnd');
      WndHandle:=FindWindow(@WndClass[0],Nil);
      ShowWindow(WndHandle,AShowState);
    end;{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      Self.Caption :=IntToStr(Mouse.CursorPos.Y)+':'+IntToStr(Screen.WorkAreaHeight);
      if Mouse.CursorPos.Y>Screen.WorkAreaHeight then//SystemParametersInfo(SPI_GETWORKAREA,0,Nil,0) then
        SetTaskBarShowState(SW_SHOW)
      else
        SetTaskBarShowState(SW_HIDE);
    end;end.
    测试通过 在窗体上加一个Timer 就可以 其他不用加
      

  6.   

    既然这样,我再试试!我用的是Delphi5.0.谢谢大家结贴了,特别感谢FS.