如何隐藏任务栏或自己编写的工具栏(100分)

  • 主题发起人 主题发起人 shangjintong
  • 开始时间 开始时间
S

shangjintong

Unregistered / Unconfirmed
GUEST, unregistred user!
Form1是工具栏,我用如下语句想隐藏他,但不能象任务栏那样自动隐藏<br>procedure TForm1.N674Click(Sender: TObject);<br>var<br>&nbsp; a:APPBARDATA;<br>begin<br>&nbsp; a.cbSize := Sizeof(a);<br>&nbsp; a.hWnd:= Form1.Handle;<br>&nbsp; a.uEdge:=ABE_TOP ;<br>// &nbsp;case SHAppBarMessage(ABM_GETSTATE,a) of<br>&nbsp; a.uCallbackMessage:=0;<br><br>&nbsp; if SHAppBarMessage(ABM_GETAUTOHIDEBAR,a)&gt;0 then<br>&nbsp; &nbsp; ShowMessage('exist')<br>&nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; a.lParam:=LParam(True);<br>&nbsp; if SHAppBarMessage(ABM_SETAUTOHIDEBAR,a)=1 then<br>&nbsp; &nbsp; SHAppBarMessage(ABM_REMOVE,a);<br>&nbsp; &nbsp; end;<br>end;<br>
 
你的Form1首先要做成AppBar才行。
 
procedure TForm1.FormCreate(Sender: TObject);<br>var<br>&nbsp; a:APPBARDATA;<br>begin<br>&nbsp; SetWindowLong(Form1.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW or WS_EX_CLIENTEDGE OR WS_EX_TOPMOST);<br>&nbsp; SetWindowLong(Form1.Handle,GWL_STYLE,WS_POPUP or WS_BORDER OR WS_CLIPCHILDREN);<br>&nbsp; InitCommonControls;<br>&nbsp; a.cbSize:=Sizeof(APPBARDATA);<br>&nbsp; a.hWnd:=Form1.Handle;<br>&nbsp; a.uCallbackMessage:=0;<br>&nbsp; a.uEdge:=ABE_LEFT;<br>&nbsp; SHAppBarMessage(ABM_NEW,a);//注册<br>&nbsp; AppBarSetPos(ABE_LEFT); &nbsp;//设置位置<br>end;<br>上面是他的Create事件
 
隐藏任务栏可以用<br>&nbsp;showwindow(findwindow('Shell_TrayWND',nil),SW_HIDE);<br>
 
我想象任务栏那样自动隐藏,而不是只隐藏,当鼠标在屏幕边缘时,他会自动出现。<br>用SHAppBarMessage(ABM_SETAUTOHIDEBAR,a)为什末不能实现<br>
 
try this:<br><br>var<br>&nbsp; a:TAPPBARDATA;<br>begin<br>&nbsp; a.cbSize := Sizeof(a);<br>&nbsp; if (SHAppBarMessage(ABM_GETSTATE,a) AND ABS_AUTOHIDE)&gt;0 then<br>&nbsp; &nbsp; ShowMessage('exist')<br>&nbsp; else <br>&nbsp; begin<br>&nbsp; &nbsp; a.ucallbackmessage:=nil;<br>&nbsp; &nbsp; a.lParam:=LParam(True);<br>&nbsp; &nbsp; SHAppBarMessage(ABM_SETAUTOHIDEBAR,a);<br>end;<br>
 
捕捉鼠标位置不就行了?!<br>当鼠标移出form就隐藏, 反之显示
 
接受答案了.
 

Similar threads

I
回复
0
查看
674
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部