Solved

Ordering by z-order.

Posted on 2000-05-02
7
424 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
7 Comments
 
LVL 30

Accepted Solution

by:
Zoppo earned 100 total points
Comment Utility
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_
Comment Utility
You can use the methods GetTopWindow() and GetNextWindow() to determine the z-order of your windows.
0
 
LVL 30

Expert Comment

by:Axter
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:jhunt
Comment Utility
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_
Comment Utility
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_
Comment Utility
My last comment correspond to zoppo's comment.
0
 

Author Comment

by:jhunt
Comment Utility
Thanks ZOPPO,

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now