 |
|
|
 |
|
 |
And if so, will you show/explain the code so can we study how it was done?
thanks
|
|
|
|
 |
|
 |
Sorry for the late reply...
I've got it working in VC++6.0, VC++7.0 and VC++7.1 without any problems..
Do you or anyone else expirience any problems?
Al it takes is some good look at the examples
Albert van Peppen
|
|
|
|
 |
|
 |
Cheers for that! Been looking for an easy way to do this for ages!
|
|
|
|
 |
|
 |
Can anyone suggest a method to hide teh icon of a Console Application?
|
|
|
|
 |
 | Java  |  | Nick | 12:48 20 Jul '00 |
|
 |
Does anyone know how to write or spawn a Java application that sits on the Taskbar, but is hidden as in the example above? This would be like a service that runs in the background like NT
|
|
|
|
 |
|
 |
I'm just a beginner, and I'm trying to figure out how to do this in Delphi
|
|
|
|
 |
|
 |
Well, it's nice that the app icon doesn't appear duplicate (in the task bar ans the system trayy as well), but unfortunately, its task entry is also removed from the task LIST within the Task Manager if the window is minimized to the tray.
How can I avoid that (I always need that task list entry to obtain the corresponding window handle by using FindWindow(...))???
Or, in other words: How do I wake up that minimized window from within another process/application?
|
|
|
|
 |
|
 |
After some thinking i figured how i got it to work in a dialog the 'correct' way, i've came up with a working idea..
This is how i got it to work in a Dialog based app:
The AppWizard generates a nice CWinApp class, lets call it CAppClass, with the following code in the InitInstance:
.....
CMyMainDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
.....
Now we have to create a parent for this dialog, which is invisible.
This can be done like the mentioned way above..
So we have to alter the code like this:
.....
// Create invisible window so we can have a icon and text
// for the taskbar's window button
CWnd *pWnd = NULL;
if (!::IsWindow(m_wndInvisible.m_hWnd)) {
LPCTSTR pstrOwnerClass = AfxRegisterWndClass(0);
if (m_wndInvisible.CreateEx( 0, pstrOwnerClass, _T(""), WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0)) {
pWnd = &m_wndInvisible;
}
// If it is not created, leave it NULL, it will apear in the taskbar: Big deal, will never happen
}
// Use the invisible window as parent for the 'main' dialog...
CMyMainDlg dlg(pWnd);
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
.....
Ofcourse you have to put the m_wndInvisible in your App Header:
.....
public:
CAppClass(); // This is your CWinApp derived class
~CAppClass();
protected: // ADD THIS: Lets make it protected...
CWnd m_wndInvisible; // ADD THIS: This is the invisible window
public: // ADD THIS: Just to make sure it stays public
// Overrides
.....
Now there is just one thing left to do; In your .RC file the dialog's EXSTYLE is default set as WS_EX_APPWINDOW...
Lets get rid of that by remark it... (If it's there..)
.....
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
// EXSTYLE WS_EX_APPWINDOW // Remark/remove this line..
CAPTION "MyMainDlg"
.....
Now compile your project and you're done!
No changes are made in your CDialog derived class!!
If anyone thinks this is not the correct way, or when i missed something, please give me a mail..
(Thanx would be nice too )
Happy coding and hacking
Albert van Peppen
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Yep, it works! But when I press ALT-TAB, the application's icon is still visible there. Do you have a clue how to remove that, too?
Regards, Wolle
|
|
|
|
 |
|
 |
Ok, I figured it out by myself. The WS_EX_TOOLWINDOW style must be set.
|
|
|
|
 |
|
 |
NICE!! Thanks..
public:
CAppClass(); // This is your CWinApp derived class
~CAppClass(); <--------I had to remove this for the program to compile..
Should I worry?
Rob
|
|
|
|
 |
|
 |
If you don't use the destructor, then you can drop it
Albert
|
|
|
|
 |
|
 |
Hello,
everything works fine but I'd like also to manage the MINIMIZE button.
If I set the WS_EX_TOOLWINDOW as follows:
::SetWindowLong( m_hWnd, GWL_EXSTYLE, GetExStyle() | WS_EX_TOOLWINDOW);
my minimize button disappears.
I am trying to make my dialog-box based application work as follows:
- When the program starts, an icon in the status bar is created, but no icon in the taskbar
- When I press the minimize button the application gets minimized. Pressing the ALT+TAB there must be no sign of the application.
- When I press the icon in the status bar the application gets back to its normal state
Any idea to make it work ??
Riccardo
|
|
|
|
 |
|
|
 |
|
 |
Your idea work for me good[yet] and is nice .
Also I think that to remove the WS_EX_APPWINDOW just add the simple following
command to your C---Dlg::OnInitDialog();
CMyDialog::OnInitDialog()
{
...
ModifyStyleEx( WS_EX_APPWINDOW, 0 );
...
}
Is it easy?
... and a question:
How can toggle to view taskbar button? such as winamp[^].
|
|
|
|
 |
|
 |
This works great for me!
I've also tested to show/hide the taskbar button; you can do it like this (within the dialog):
// hide taskbar button
ShowWindow(SW_HIDE);
ModifyStyleEx(WS_EX_APPWINDOW, 0);
ShowWindow(SW_SHOW);
// show taskbar button
ShowWindow(SW_HIDE);
ModifyStyleEx(0, WS_EX_APPWINDOW);
ShowWindow(SW_SHOW);
Best wishes
|
|
|
|
 |
|
 |
It works perfectly...
thx a lot ^_^
|
|
|
|
 |
|
 |
One other item:
When your dialog is visible and you ALT+TAB, the icon will be the stock Windows "App" icon. This is because Windows is retrieving the icon from your app's root window - m_wndInvisible.
To have Windows use your App's (dialog's) icon (IDR_MAINFRAME by default), you need to add the lines in blue to your dialog's OnInitDialog:
BOOL CMyMainDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); SetIcon(m_hIcon, FALSE); <font color="blue">
CWnd* pParent = GetParent();
if(::IsWindow(pParent->GetSafeHwnd()))
{
pParent->SetIcon(m_hIcon, TRUE);
pParent->SetIcon(m_hIcon, FALSE);
}
</font>
...
|
|
|
|
 |
|
 |
Dear,
I created dialog and followed your instructions but application's icon still be at taskbar.
Can you tell me how you setting dialog's properties? (I didn't add my application at tray, I will do it in future)
....
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CWnd *pWnd = NULL;
if (!::IsWindow(m_wndInvisible.m_hWnd))
{
LPCTSTR pstrOwnerClass = AfxRegisterWndClass(0);
if (m_wndInvisible.CreateEx(0, pstrOwnerClass, _T(""), WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0))
{
pWnd = &m_wndInvisible;
}
}
CShowDlg dlg(pWnd);
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
in RC file:
...
IDD_SHOWIMAGE_DIALOG DIALOGEX 0, 0, 117, 97
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
FONT 8, "MS Sans Serif"
|
|
|
|
 |
|
 |
Even though it does not show in the taskbar, it shows as a minimized title bar on top of the task bar. this I think defeats the whole purpose of making it tatally invisible. Is there a way to make it totally invisible , not even show in the Alt+Tab combination ??
|
|
|
|
 |
|
 |
Hello
I want your source code on this feild.
Please send me.
Thank you.
A.A Rashidi
|
|
|
|
 |
|
|
 |