Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Child Window Z-Order problem..

Posted on 1998-11-13
6
Medium Priority
?
1,110 Views
Last Modified: 2013-11-20
I have a CWnd top-level window and several CWnd derived child windows inside it.

How do I fix the Z-order of these child windows, even when the windows is clicked apon?
0
Comment
Question by:Gumpster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
elf_k earned 450 total points
ID: 1324629
It seems to me
wndChild.SetWindowPos(&wndChildInsertAfter<îr &wndTop or &wndBottom>,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
will help. If not, please describe more details of the problem.
0
 

Author Comment

by:Gumpster
ID: 1324630
The toplevel window will contain a series of child windows; each child window will contain some graphics on its own separate layer(like adobe photoshop).  Each window will have to be fixed in the z-order chain, even when the window is clicked apon and activated.  I want to be able to move/size each child window without bringing that window to the front.
0
 
LVL 1

Expert Comment

by:elf_k
ID: 1324631
Aha! When you want to avoid changing windows Z-Order you can catch WM_WINDOWPOSCHANGING message and "or" flags field of WINDOWPOS struct with SWP_NOZORDER. Your window will not change ZOrder in this case.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:V245
ID: 1324632
I think the solution is to override WM_WINDOWPOSCHANGING:

void CChildFrame::OnWindowPosChanging(WINDOWPOS* lpWinPos)
{
      lpWinPos->flags |= SWP_NOZORDER;
}
0
 

Author Comment

by:Gumpster
ID: 1324633
I tried this and it did not work.  This is because you can call SetWindowPos with the SWP_NOSENDCHANGING flag and no WM_WINDOWPOSCHANGING message is sent.

Instead I have trapped the WM_WINDOWPOSCHANGED message and added a SetWindowPos call there:

void CChildWindow::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
      CWnd::OnWindowPosChanged(lpwndpos);
      
      if (m_pInsertAfter!=NULL)
            this->SetWindowPos(m_pInsertAfter, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
}

0
 

Author Comment

by:Gumpster
ID: 1324634
I tried this and it did not work.  This is because you can call SetWindowPos with the SWP_NOSENDCHANGING flag and no WM_WINDOWPOSCHANGING message is sent.

Instead I have trapped the WM_WINDOWPOSCHANGED message and added a SetWindowPos call there:

void CChildWindow::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
      CWnd::OnWindowPosChanged(lpwndpos);
      
      if (m_pInsertAfter!=NULL)
            this->SetWindowPos(m_pInsertAfter, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
}

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question