Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Hide App from taskList 1

Status
Not open for further replies.

tobs

Programmer
Jun 30, 2000
4
PH
How do i make my application hidden in the tasklist so no one can remove it using ctrl-alt-del?
 
&nbsp;&nbsp;&nbsp;&nbsp;First, to hide the icon from the taskbar, do the following . . .<br>ShowWindow(Application-&gt;Handle, SW_HIDE);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;To make it reappear (if you need to), do this . . .<br>ShowWindow(Application-&gt;Handle, SW_SHOW);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;To hide your form from the tasklist, you will need to use <i>GetWindowLong</i> and <i>SetWindowLong</i> in your WinMain function like this . . .<br>WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwExStyle = GetWindowLong(Application-&gt;Handle, GWL_EXSTYLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;dwExStyle ¦= WS_EX_TOOLWINDOW;<br>&nbsp;&nbsp;&nbsp;&nbsp;SetWindowLong(Application-&gt;Handle, GWL_EXSTYLE, dwExStyle);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;try<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application-&gt;CreateForm(__classid(TForm1), &Form1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application-&gt;Run();<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;catch (Exception &exception)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application-&gt;ShowException(&exception);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br>}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;These snippets came from the &quot;FAQ&quot; section of <A HREF=" TARGET="_new"> .<br> <p>James P. Cottingham<br><a href=mailto: > </a><br><a href= Veneer Co., Inc.</a><br>All opinions are mine alone and do not necessarily reflect those of my employer.
 
How do i implement the given code using OWL framework? What window should i pass to the GetWindowLong and where do i insert this?
 
&nbsp;&nbsp;&nbsp;&nbsp;Opps. I didn't realize that you were using OWL. I've never used OWL so I threw my old manuals out. This will work with BCB (Borland C++ Builder). The Window's name is sent to <i>GetWindowLong</i> in the <i>Application-&gt;Handle</i>. This is put into the Window's <i>WinMain</i> code section. I'm not familar enough with OWL to translate it. Sorry.<br> <p>James P. Cottingham<br><a href=mailto: > </a><br><a href= Veneer Co., Inc.</a><br>All opinions are mine alone and do not necessarily reflect those of my employer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top