任务栏,解决给分 请问如何将任务栏设成自动隐藏.修改注册表还是用api 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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; 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.刚写的,完全可以实现你要的功能! Screen.WorkAreaHeight 提示找不到! 哥们啊,你自己好好调试调试吧,偶那个代码是在我机器上运行过以后才贴上来的!你要还说有错误,偶可真是没有折子了!Screen是全局变量,为TSreen类型,这个类型是在单元Forms中申明的,后面的WorkAreaHeight是它的属性,表示工作区(去掉任务栏后)的高度!自己再试试吧! 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 就可以 其他不用加 既然这样,我再试试!我用的是Delphi5.0.谢谢大家结贴了,特别感谢FS. 请求帮助 关于PReport1里的IMAGE Brush.Bitmap的问题 怎样更换PopupMenu的图片? 高手请进!!!!! 如何实现 多列(multicolumn) combobox 谁能提供个DB Commander 2000 pro的注册号呀? 怎样将Excel导入到DbGrid中 在MDI窗口中如何使滚动条不出现 DBGrid控件的OnColExit事件如何判断是从那一列(字段fields)失去焦点的 文本文件如何导入access数据库 散分:请各位大侠进来聊聊! 请斑竹手下留情,转载。。。老问题,新内容!
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;
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.刚写的,完全可以实现你要的功能!
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 就可以 其他不用加