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 Chris 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 an application just like hiding taskman?

Status
Not open for further replies.

CStrugling

Programmer
Apr 10, 2007
9
JP
Does anybody here how to hide an application just like hiding a task manager? Using minimize window.

 
Let's see if this will help. It is from (the now defucnt) BCBDEV.com.
Q: Hide the application's taskbar icon

Answer:


First, let's get some terminology straight. The system tray is the little box in the corner of the task bar where programs can display small icons. Some examples include the SysAgent icon, and the Outlook icon when you get new mail. The taskbar is the toolbar that stretches across the screen. This is where program icons are located. To hide a program's taskbar icon, you call the ShowWindow function and pass the Application->Handle window handle.

Code:
ShowWindow(Application->Handle, SW_HIDE);

To make the taskbar icon re-appear, simply change SW_HIDE to SW_SHOW.

Code:
ShowWindow(Application->Handle, SW_SHOW);

Note: You can hide the main form by setting its Visible property to false.

Note: Hiding the form's taskbar icon with ShowWindow is not permanent. Certain actions will cause the taskbar icon to reappear. You can remove a program's taskbar icon and prevent it from ever appearing again by making the hidden application window a tool window. Tool windows never have a taskbar icon. Making the application window a tool window has the side effect of removing the program from the list of programs that appear when the user presses ALT-TAB. You can make the application window a tool window by calling the API GetWindowLong and SetWindowLong functions.

Code:
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    DWORD dwExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);
    dwExStyle |= WS_EX_TOOLWINDOW;
    SetWindowLong(Application->Handle, GWL_EXSTYLE, dwExStyle);

    try
    {
         Application->Initialize();
         Application->CreateForm(__classid(TForm1), &Form1);
         Application->Run();
    }
    catch (Exception &exception)
    {
         Application->ShowException(&exception);
    }
    return 0;
}


Copyright © 1997-2000 by Harold Howe.
All rights reserved.

James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
wow! thanks for this.
got what i want.

go CodeGear forum... thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top