📄 lc_bcb_87.html
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>怎样隐藏应用程序的任务条图标</title>
</head>
<body>
<h3 align="center"> 怎样隐藏应用程序的任务条图标</h3>
<h3>问: 怎样隐藏应用程序的任务条图标</h3>
<h3>答:</h3>
<p>首先,请看看这些术语。<b><u>系统托盘</u></b>是一个在任务条右角的小方框,在托盘了应用程序可以显示小图标<b><u>。任务条</u></b>是可以在屏幕上伸展的工具栏。它就是程序图标所在的位置。想隐藏程序的任务条图标,你可以应用ShowWindow函数并传给它Application->Handle窗口句柄。</p>
<pre> <span style="BACKGROUND-COLOR: silver"> ShowWindow(Application->Handle, SW_HIDE);</span></pre>
<p>若想让任务条图标再出现,只需将SW_HIDE改为SW_SHOW。</p>
<pre> <span style="BACKGROUND-COLOR: silver">ShowWindow(Application->Handle, SW_SHOW);</span></pre>
<p><b>注:</b> 你可以设置主窗口的Visible属性为false来隐藏它。</p>
<p><b>注:</b> 通过ShowWindow来隐藏窗口的任务条图标是不持久的。某些动作会使任务条图标重现。你可以将隐藏的应用程序窗口设为Tool
Window来移走程序的任务条图标而避免它再次出现。Tool windows永远不会有任务条图标。
使应用程序窗口成为一个Tool Window有一个副作用:当用户按下Alt-TAB时它将不在程序列表中出现。你可以调用API函数GetWindowLong和SetWindowLong来使应用程序窗口成为一个Tool
Window。</p>
<pre> <span style="BACKGROUND-COLOR: silver"> WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, <b>int</b>)</span>
<span style="BACKGROUND-COLOR: silver"> {</span>
<span style="BACKGROUND-COLOR: silver"> DWORD dwExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);</span>
<span style="BACKGROUND-COLOR: silver"> dwExStyle |= WS_EX_TOOLWINDOW;</span>
<span style="BACKGROUND-COLOR: silver"> SetWindowLong(Application->Handle, GWL_EXSTYLE, dwExStyle);</span>
<span style="BACKGROUND-COLOR: silver"> <b>try</b></span>
<span style="BACKGROUND-COLOR: silver"> {</span>
<span style="BACKGROUND-COLOR: silver"> Application->Initialize();</span>
<span style="BACKGROUND-COLOR: silver"> Application->CreateForm(<b>__classid</b>(TForm1), &Form1);</span>
<span style="BACKGROUND-COLOR: silver"> Application->Run();</span>
<span style="BACKGROUND-COLOR: silver"> }</span>
<span style="BACKGROUND-COLOR: silver"> <b>catch</b> (Exception &exception)</span>
<span style="BACKGROUND-COLOR: silver"> {</span>
<span style="BACKGROUND-COLOR: silver"> Application->ShowException(&exception);</span>
<span style="BACKGROUND-COLOR: silver"> }</span>
<span style="BACKGROUND-COLOR: silver"> <b>return</b> 0;</span>
<span style="BACKGROUND-COLOR: silver"> }</span></pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -