?
Solved

getting open window count

Posted on 2002-04-08
3
Medium Priority
?
266 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

762 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