eladyanai
eladyanai

Reputation: 1093

how to hide CDialogEX from taskbar? (MFC C++)

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?

Upvotes: 1

Views: 1565

Answers (2)

sergiol
sergiol

Reputation: 4337

Some bibliography for you:

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.

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 612794

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.

Upvotes: 3

Related Questions