Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Win32 MFC VC++
Hi
 
I have a need to change the Z order of a popup dialog within a application, which has both child & other popup dialogs. The application consists of multiple POPUP & one CHILD dialog under a view. After a user action, i need to change the Z order of one of the Popup dialogs and send it behind all the existing dialogs (including the child dialog).
 
The issue i am facing is the popup dialog is not going behind Child dialog (while is it going behind rest of the popup dialogs of the app as expected). Changing the style of the only Child dialog to popup is not an option for me. Can we not place a popup dialog behind a child?
 
Following code is used to change the Z Order:
SetWindowPos(&CWnd::wndBottom, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING);
 
Any help is greatly appreciated.
 
Thanks,
Aravind B.
Posted 25-Nov-12 23:14pm
Edited 25-Nov-12 23:17pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I think you cannot achieve this.
 
The following is from the remark section of the SetWindowPos[^]:
Quote SetWindowPos[^]:
A non-topmost window can own a topmost window, but the reverse cannot occur. Any window (for example, a dialog box) owned by a topmost window is itself made a topmost window, to ensure that all owned windows stay above their owner.
As your pop up is owned by the child dialog it cannot be hidden behind it.
  Permalink  
Comments
Aravind Badrinath Krishnan at 26-Nov-12 5:43am
   
Thanks for the response.
In my case the pop up dialog i am trying to push down the Z Order is not owned by the Child dialog. The pop up window and the child dialog both are siblings of the same view. The issue here is that SetWindowPos does not push the popup dialog below a child dialog, which is owned by the view.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100