 |
|
 |
i think if u have a menu based dialog , u can not opt to make it a child else your menus would be gone
thanx
|
|
|
|
 |
|
 |
Hi techies,
I have created the dialog based application and for some unavoidable reasons, I was supposed to call another property sheet's DoModal function from the OnInitDialog function of my main application dialog class. Becoz of which task bar icon was not appearing. And then putting
// Show the task bar icon
ModifyStyleEx(0,WS_EX_APPWINDOW); this code in OnInitDialog of Property sheet worked and Task bar icon was appearing. But no luck with taskmanager list
Any help in this will be great help to me.
regards
smitha
My application class
BOOL CFlowCalSIDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
**** My code goes here**********
theApp.m_hMainWnd = m_hWnd;
CMyPropertySheet pSheet( IDS_TITLE_FCFV /*_T( "My appl" )*/ );
pSheet.SetWizardMode();
pSheet.DoModal();
**** My code goes here**********
return TRUE; // return TRUE unless you set the focus to a control
}
and in CMyPropertySheet.cpp file
BOOL CMyPropertySheet::OnInitDialog()
{
//Set the sheet icon
HICON hIcon = theApp.LoadIcon(MAKEINTRESOURCE(IDR_MAINFRAME));
SetIcon(hIcon, TRUE); // Set big icon.
SetIcon(hIcon, FALSE); // Set small icon
// Show the task bar icon
ModifyStyleEx(0,WS_EX_APPWINDOW);
return CPropertySheet::OnInitDialog();
}
|
|
|
|
 |
|
 |
Hi,
Could you solve this problem. I am also having the same problem, if you find the solution please let me know.
|
|
|
|
 |
|
 |
yes this was very useful , but i need to remove it fully not even in alt+tab combination.
how do i make it,pl help me.
|
|
|
|
 |
|
 |
Sorry my english.
Here is what I did:
In the InitInstance() function inthe CWinapp derived class created by the wizard in a dialog project
......
//Create a new dinamic "CInvisibleDlg" object
CInvisibleDlg* dlg = new CInvisibleDlg;
//Asingn the pointer to the m_pMainWnd variable
m_pMainWnd = dlg;
//Call Run for the Cwinapp derived class to begin the message loop
Run();
//When the dialog quits we delete it
delete dlg;
return FALSE;
} //End of the InitInstance() function
//////////////////////////////////////////////////////////////////////////////
In the .RC file change the dialog's EXSTYLE from WS_EX_APPWINDOW to WS_EX_TOOLWINDOW
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE |
WS_CAPTION
EXSTYLE WS_EX_TOOLWINDOW // Change WS_EX_APPWINDOW to WS_EX_TOOLWINDOW
and if you want a invisible window comment "WS_VISIBLE"
/////////////////////////////////////////////////////////////////////////////
And finally in the CDialog derived class, in this case "CInvisibleDlg", from within the Constructor just call Create( IDD ) were IDD is the resource simbol of the dialog template.
Just one last thing, in the dialog I override the function "OnOk()" to call "postQuitMessage( 0 )" because of another way the App never ends.
Hope This helps, and again sorry for my poor english.
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
For any Doc/View application, change the fist argument in CreateEx() from 0 to WS_EX_TOOLWINDOW if you want to hide it from Alt-Tab. In this way, the created invisible window has WS_EX_TOOLWINDOW style, which does not appear in the task bar or in the window that appears when the user presses ALT+TAB. At the same time, invisible window's caption bar doesn't show up at all. No concern about the shrinked caption bar.
A perfect solution combined with Chris's code and MS WS_EX_TOOLWINDOW style.
|
|
|
|
 |
|
|
 |
|
 |
How I can add an icon in the left superior corner (title of program) in a SDI, without enabling Document/View Architecture Support in Step 1.
thank you
|
|
|
|
 |
|
 |
How I can add an icon in the left superior corner (title of program) in a SDI, without enabling Document/View Architecture Support in Step 1.
thank you
|
|
|
|
 |
|
 |
Hello
I'm a graduating student with almost no experience in professional programming and I have a question:
How can I make my Visual Basic 6.0 windows application to run and show only as tray icon and not on task bar?
Thank you in advance
mickey
|
|
|
|
 |
|
 |
Solution is
CMainFrame::OnCreate () {
...
HICON icon = (HICON)::GetClassLong(m_hWnd, GCL_HICON);
if(icon)
{
HWND wnd = m_wndInvisible.m_hWnd;
::SetClassLong(wnd, GCL_HICON, (LONG)icon);
::SetClassLong(wnd, GCL_HICONSM, (LONG)icon);
}
|
|
|
|
 |
|
 |
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 icon in the status bar the application gets back to its normal state
Give me a demo !
ZHANGYIFEI
|
|
|
|
 |
|
|
 |
|
 |
In MSDN, they tell you the following to accomplish the same thing.
"To prevent the window button from being placed on the taskbar, create the window with the WS_EX_TOOLWINDOW extended style."
|
|
|
|
 |
|
 |
...and you end up with a teensy-weensy caption bar
cheers,
Chris Maunder
|
|
|
|
 |
|
 |
Yes you do, but you have to add one more line of code according to MSDN to remove the teensy-weensy caption bar, and here goes: "you must hide the window first (by calling ShowWindow with SW_HIDE)".
I made a small code example:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(szWindowClass, szTitle, WS_EX_TOOLWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
ShowWindow(hWnd, FALSE);
return TRUE;
}
|
|
|
|
 |
|
 |
Hello
This code seems weired to me.
See my posting below.
Elmü
modified 14 May '12.
|
|
|
|
 |
|
 |
To get to the perfect solution:
1.)
Do NOT use WS_EX_TOOLWINDOW for the visible window because this flag shows an ugly caption bar and removes the Minimize, Maximize buttons from the caption bar. (teensy weensy as Chris says)
2.)
Using an invisible parent for your visible window as described in the article makes the taskbar button disappear, which is what we want. BUT in the Task-Switch window (when hitting ALT + TAB) the invisible window is listed, which is ugly. (it does not even have an icon)
3.)
To avoid the latter the !invisible window! needs the flag WS_EX_TOOLWINDOW.
4.)
Another option (if you want the Icon to appear in the Task-Switch window) is to explicitly set the icon for the invisible window.
So here the perfect code:
Header file:
#define SHOW_TASKBAR_BUTTON FALSE #define SHOW_TASKSWITCH_ICON TRUE
CWnd mi_Invisible;
CPP File:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
#if !SHOW_TASKBAR_BUTTON
if (!::IsWindow(mi_Invisible.m_hWnd))
{
DWORD u32_ExStyle = WS_EX_TOOLWINDOW;
#if SHOW_TASKSWITCH_ICON
u32_ExStyle = 0;
#endif
if (!mi_Invisible.CreateEx(u32_ExStyle, L"#32770", L"Invisible",
WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0))
return FALSE;
#if SHOW_TASKSWITCH_ICON
mi_Invisible.SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
mi_Invisible.SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);
#endif
}
cs.hwndParent = mi_Invisible.m_hWnd;
cs.style &= ~WS_MINIMIZEBOX;
#endif
return TRUE;
}
P.S.
"#32770" is the class name for dialogs.
P.P.S.
The Minimze button does not make sense for a window without taskbar button
modified 15 May '12.
|
|
|
|
 |
|
 |
Use the extended window style WS_EX_TOOLWINDOW combined with the window style WS_POPUP. No more taskbar icon !!!
|
|
|
|
 |
|
|
 |
|
 |
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!
|
|
|
|
 |