Solved

Ordering by z-order.

Posted on 2000-05-02
7
425 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 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 65
dog bark java program 15 87
Doc'in system (example?) BA 7 87
sumHeights  challenge 17 66
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

911 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

20 Experts available now in Live!

Get 1:1 Help Now