Board index » cppbuilder » Hide Application

Hide Application


2005-10-22 07:38:21 AM
cppbuilder38
How can I hide my application from the ALT+TAB feature to toggle between
programs in Windows?
 
 

Re:Hide Application

"oLiVeS" <olives3#Remove#@earthlink.net>wrote in message
Quote
How can I hide my application from the ALT+TAB feature to
toggle between programs in Windows?
Use SetWindowLong() to give the TApplication::Handle the WS_EX_TOOLWINDOW
style, ie:
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
DWORD dwExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);
dwExStyle |= WS_EX_TOOLWINDOW;
SetWindowLong(Application->Handle, GWL_EXSTYLE, dwExStyle);
//...
}
However, do note that this approach removed the application's default
taskbar button as well.
Gambit
 

Re:Hide Application

Quote
Use SetWindowLong() to give the TApplication::Handle the WS_EX_TOOLWINDOW
style, ie:

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
DWORD dwExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);
dwExStyle |= WS_EX_TOOLWINDOW;
SetWindowLong(Application->Handle, GWL_EXSTYLE, dwExStyle);
//...
}
*scratches head*
It does remove the taskbar button but I can still Alt+Tab to the program.
Quote
However, do note that this approach removed the application's default
taskbar button as well.
That's what I want so it's fine.
 

{smallsort}

Re:Hide Application

"oLiVeS" <olives3#Remove#@earthlink.net>wrote in message
Quote
It does remove the taskbar button but I can still Alt+Tab to the program.
ToolWindows cannot appear in the Alt-Tab dialog. If you still see our app
in the dialog, then it has to be picking up one of your TForm windows
instead of the TApplication window. What is your EXACT setup?
Gambit
 

Re:Hide Application

Quote
ToolWindows cannot appear in the Alt-Tab dialog. If you still see our app
in the dialog, then it has to be picking up one of your TForm windows
instead of the TApplication window. What is your EXACT setup?

Gambit
BCB6 on Windows 2000 SP4
I changed the BorderStyle from bsNone to bsToolWindow and it no longer
shows up in the Alt+Tab list; however, it now has a titlebar and it's not
what
I want.
The program Just shows some small brief info on a bsNone dialog then
animates off the screen so I don't want a titlebar so the user can drag it
elsewhere on the desktop.
//--------------------------------------------------------------------------
-
Ok I changed the BorderStyle to bsDialog and added the following code
to remove the Caption because it wouldn't remove it with the
bsToolWindow option.
.h
private: // User declarations
void __fastcall CreateParams(TCreateParams &Params);
.cpp
void __fastcall TMain::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params); // call base class first
Params.Style &= ~WS_CAPTION; // then clear caption bit
}
 

Re:Hide Application

"oLiVeS" <olives3#Remove#@earthlink.net>wrote in message
Quote
I changed the BorderStyle from bsNone to bsToolWindow and it
no longer shows up in the Alt+Tab list; however, it now has a titlebar
Did you try removing biSystemMenu from the BorderIcons property?
Quote
and it's not what I want.
What EXACTLY do you want?
Quote
The program Just shows some small brief info on a bsNone dialog
then animates off the screen so I don't want a titlebar so the user can
drag it elsewhere on the desktop.
There are ways to prevent dragging. The easiest is to intercept the
WM_NCHITTEST message. Pass the message to the default handler first. If it
returns HT_CAPTION then change the message result to HT_CLIENT instead.
Gambit