Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » SetLayeredWindowAttributes Fails Error Code 87 Collapse All
Subject Author Date
Christopher Favreau Oct 22, 2008 - 3:19 PM

I am attempting to make a CExtControlBar and its child semi transparent.  Here is my code:


    // Set the status window transparent

    if (m_wndECBStatus.ModifyStyleEx(0, WS_EX_LAYERED | WS_EX_TRANSPARENT, 0) == 0)

    {

        TRACE("Failed to ModifyStyleEx on the Status Window! ERROR(%u)\n", GetLastError());

    }



    if (m_wndECBStatus.SetLayeredWindowAttributes(0, 0, LWA_ALPHA) == 0)

    {

    TRACE("Failed to SetLayeredWindowAttributes on Status Window! ERROR(%u)\n", GetLastError());

    }


The call to SetLayeredWindowAttributes always fails with error code 87.  The documentation says that 87 means invalid parameter.  The only thing that I can find as far as a reason why is that the control bar is being created with the WS_CHILD attribute.  I have read that a window needs the WS_OVERLAPPED or WS_POPUP attribute and will not work with WS_CHILD windows.


I have tried the WS_OVERLAPPED attribute but it still does not work.    I have also tried WS_POPUP however it trips an ASSERT in the Create function of CWnd (I think).


Do you have any suggestions as to how I may make this work?


Thanks in advance,

 Chris F.


 


 

Technical Support Oct 23, 2008 - 2:03 PM

Actually a floating control bar is made up of three windows:

1) The floating mini frame window (also known as a floating palette window). It is a CExtMiniDockFrameWnd window in the case of Prof-UIS. It is a CMiniDockFrameWnd window in the case of MFC. Both are kind of CFrameWnd. So, invoking control bar’s GetParentFrame() method returns a pointer to the main frame for docked control bars and a pointer to the floating palette frame for floating control bars.

2) The child of the floating palette frame window is dock bar window (CDockBar). It completely covers client area of its parent floating palette window.

3) The dock bar’s child is control bar which is switched into floating state.

Such construction is required because parent window of re-dockable control bar is always dock bar window both in MFC and Prof-UIS. You should make the floating palette frame window layered - not the control bar window. You should use your own CExtControlBar-derived class which implements the CExtControlBar::OnCreateFloatingFrame() virtual method. Your implementation of this virtual method should be similar to original but it should make the floating palette frame window layered with required transparency level.

Jeremy Richards Oct 23, 2008 - 8:03 AM

Layered windows MUST be top level windows, they cannot be child windows.


You cannot make a control bar semi transparent, unless it is floating.  You could probably make the frame holding a floating control bar semi-transparent, although that could get complex real quickly if you can dock the windows together or form tab groups with them.