任务栏,解决给分

Dephiuser 2003-09-23 10:29:19
请问如何将任务栏设成自动隐藏.
修改注册表还是用api
...全文
23 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
FrameSniper 2003-09-24
  • 打赏
  • 举报
回复
Timer组件的Interval:=1;
FrameSniper 2003-09-24
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
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;

implementation

procedure 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.

刚写的,完全可以实现你要的功能!
lxhong1980 2003-09-24
  • 打赏
  • 举报
回复
学习
Shiyl 2003-09-24
  • 打赏
  • 举报
回复
不会!
horse_h 2003-09-24
  • 打赏
  • 举报
回复
UP
gdwyh 2003-09-24
  • 打赏
  • 举报
回复
学习
Dephiuser 2003-09-24
  • 打赏
  • 举报
回复
谢谢!
Dephiuser 2003-09-24
  • 打赏
  • 举报
回复
既然这样,我再试试!我用的是Delphi5.0.谢谢大家结贴了,特别感谢FS.
duxin 2003-09-24
  • 打赏
  • 举报
回复
fs 的代码整理如下
unit Unit1;

interface

uses
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;

implementation

procedure 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 就可以 其他不用加
FrameSniper 2003-09-24
  • 打赏
  • 举报
回复
哥们啊,你自己好好调试调试吧,偶那个代码是在我机器上运行过以后才贴上来的!你要还说有错误,偶可真是没有折子了!

Screen是全局变量,为TSreen类型,这个类型是在单元Forms中申明的,后面的WorkAreaHeight是它的属性,表示工作区(去掉任务栏后)的高度!自己再试试吧!
Dephiuser 2003-09-24
  • 打赏
  • 举报
回复
Screen.WorkAreaHeight 提示找不到!
Dephiuser 2003-09-23
  • 打赏
  • 举报
回复
楼上的方法是可以隐藏任务栏.但我想自动隐藏,鼠标移动到任务栏,显示任务栏!
有其他方法吗?
FrameSniper 2003-09-23
  • 打赏
  • 举报
回复
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;
dawnming 2003-09-23
  • 打赏
  • 举报
回复
帮你up一下

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧