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
Solved

Ordering by z-order.

Posted on 2000-05-02
7
426 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
Turn a spreadsheet into a vba executable. 2 92
Pressing cancel button with C# UI Automation 3 80
viewing source code from eclipse 13 110
Line meaning 9 87
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 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