Solved

Ordering by z-order.

Posted on 2000-05-02
7
427 Views
Last Modified: 2013-11-20
I have a Save-All-Modified dialog that displays a list view with a list of documents that have been modified. Currently it is sorted alphabetically by filename. I would like it to be sorted by the order of when the documents were last used. Basically it comes down to this:

I have two documents. I have to decide which one has a view that is higher in the z-order than the other ones views. Isn't there a windows routine to take to HWND and tell you which one is higher in the z-order?
0
Comment
Question by:jhunt
[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
7 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 100 total points
ID: 2769876
Hi jhunt,

First there's no function to compare two windows by their z-order. It wouldn't be too hard to implement one using GetWindow() with flags GW_HWNDNEXT/GW_HWNDPREV, but I think it would be a better approach (better performance) to simply enumerate through all windows once using MDIGetActive() and GetWindow() with flags GW_HWNDNEXT/GW_HWNDPREV.

In the URL I provided you on the other task (with the 'Windows...' menu) you can find how to enumerate through the windows. You can use similar code to fill a list/array of document pointers to avoid duplicate occurances of documents in your list.

hope that helps,

ZOPPO
0
 
LVL 3

Expert Comment

by:_mb_
ID: 2769924
You can use the methods GetTopWindow() and GetNextWindow() to determine the z-order of your windows.
0
 
LVL 30

Expert Comment

by:Axter
ID: 2771113
I think you can use the CWnd::SetWindowPos function.

According to the help doc, you can use the pWndInsertAfter parameter to indicate the previous window in the z-order.
To make this function ignore the (int x, int y, int cx, int cy) values, use SWP_NOMOVE|SWP_NOSIZE.
Example:
SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);

or

SetWindowPos(&MyPreviousWindow,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jhunt
ID: 2772154
I tried the GetTopWindow() and GetNextWindow()/GetPreviousWindow(). I also tried GetWindow(GW_CHILD) and GetWindow(GW_HWNDNEXT)/GW_HWNDPREVIOUS. Both of these didn't return any windows that were CFrameWnds. They only return CControlBar's, CToolbar's, CStatusBar's and CTempWnd's when using GW_HWNDNEXT and when using previous they returned NULL right away. Is there a window inside the mainframe that contains the child windows or something?
0
 
LVL 3

Expert Comment

by:_mb_
ID: 2772190
It should work if you start with:
(CWnd *) wnd = MDIGetActive();
and then call (in a loop):
wnd =  wnd->GetNextWindow();

0
 
LVL 3

Expert Comment

by:_mb_
ID: 2772198
My last comment correspond to zoppo's comment.
0
 

Author Comment

by:jhunt
ID: 2775461
Thanks ZOPPO,

I did figure it out in the end using GetActiveFrame().
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 55
wordappend challenge 8 223
how to split multiple lines delimiter : 8 119
Message not shown 5 86
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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