Solved

Ordering by z-order.

Posted on 2000-05-02
7
428 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
Independent Software Vendors: 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 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