Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

getting open window count

Posted on 2002-04-08
3
Medium Priority
?
267 Views
Last Modified: 2013-11-20
I have an MDI application, and I need to count all currently open views. One way to do it would be using GetTopWindow() and GetNextWindow() functions, which would permit me to start from the topmost window and count all of them in z order, step by step. But isn't there a shorter way to get this count, maybe, from a single function call ?

I even need not the exact count, but rather a close upper bound estimate: how many views do I have currently open at most.
0
Comment
Question by:olegsp
[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
3 Comments
 
LVL 3

Accepted Solution

by:
GGRUNDY earned 200 total points
ID: 6926637
If counting your own views is all you are after then, I suppose you could have your views increment and decrement a global variable.
But really you ought to consider yourself lucky that GetTopWindow etc is so straight forward, most simple tasks that one wants to perform in Windows turn out to be way more annoying/complicated/tricky/frustrating/unobvious/error-prone than this.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6928191
Why don't you just

UINT CMyDoc::GetViewCount ()
{
   UINT unViews = 0;

   POSITION pos = GetFirstViewPosition();
   while (pos != NULL)
   {
      CView* pView = GetNextView(pos);
      unViews++;
   }  
   return nViews;
}
0
 
LVL 1

Author Comment

by:olegsp
ID: 6932148
jkr,
You are offering essentially the same iterator-based approach as I have with GetNextWindow(). I was looking rather for a single API function call to retrieve the total number of current views.
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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

636 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