I have the main-frame, when someone 开发者_运维百科is pressing a button I open a CDialogEX.
After I open it, it get's an empty task-bar tab, with no title or icon...
i want it to open as a child window of the main-frame and without task-bar tab.
i have tried using styles and stuff, but nothing works.
any ideas?
I'm guessing you are passing NULL
as the parent window. Pass the window handle of your main application's window. When you pass NULL
the created window is an unowned top-level window and they get taskbar buttons.
Some bibliography for you:
- http://www.codeguru.com/cpp/frameworks/advancedui/article.php/c3227
- http://www.codeguru.com/forum/archive/index.php/t-442093.html
- http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/2d2ef9ad-487b-43d2-997b-e0c2540064d6/
- http://www.progtown.com/topic62404-hide-mainframe-from-taskbar.html
- http://www.codeproject.com/Articles/191/Creating-an-application-with-no-taskbar-icon
Now the real work. Declare a
CWnd m_wndHidden;
in your class.
Then implement the following method
BOOL CMyMDIChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if (!__super::PreCreateWindow(cs))
return FALSE;
// Create hidden window
if (!::IsWindow(m_wndHidden.m_hWnd))
{
pstrOwnerClass = AfxRegisterWndClass(0);
if (!m_wndHidden.CreateEx(0, pstrOwnerClass, _T(""), WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, 0))
return FALSE;
}
cs.hwndParent = m_wndHidden.m_hWnd;
return TRUE;
}
The first and last link I provided are based on this approach.
精彩评论