?? l1.htm
字號:
<html>
<head>
<title>怎樣啟動一個程序而不顯示它</title>
<meta http-equiv="目錄類型" content="文本/html; 字符集=gb2312">
<link rel="stylesheet" href="../bcbget.myric/l/Css.css" tppabs="http://bcbget.myrice.com/l/Css.css">
</head>
<body bgcolor="#FFFFFF">
<table width="100%" border="0" height="285">
<tr>
<td height="35">
<div align="center" class="p14"><font color="#000000"><font >怎樣啟動一個程序而不顯示它</font></font></div>
</td>
</tr>
<tr valign="top">
<td>
<p><font color="#000000" >為了啟動程序而不顯示它,你必須編輯WinMain函數來程序的主窗口和程序的任務條圖標。</font></p>
<p><font color="#000000"><font ><b>第一步:從C++Builder菜單中選擇</b> View|Project
Source然后開始編輯WinMain函數。調用ShowWindow函數,傳遞Application->Handle,可以隱藏程序的任務條圖標。設置ShowMainForm為False可以讓主窗口不在屏幕上顯示。</font></font></p>
<pre><font color="#000000"><font > </font><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"> <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->ShowMainForm = <b>false</b>;</span>
<span style="BACKGROUND-COLOR: silver"> ShowWindow(Application->Handle, SW_HIDE);</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></font></pre>
<p><font
><b><font color="#000000">第二步:當你想顯示程序時執行下面這兩行代碼。記住,如果代碼定位在主窗口類的一個方法中,Application->MainForm->Visible=true可以用Visible=true</font></b></font><font color="#000000"
> 來代替。</font></p>
<pre><font color="#000000"><font > ShowWindow(Application->Handle, SW_SHOW);</font>
<font > Application->MainForm->Visible = <b>true</b>;</font>
</font></pre>
</td>
</tr>
</table>
<br>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -