Solved

DeferWindowPos doesn't always cause OnSize message

Posted on 2002-07-09
3
545 Views
Last Modified: 2012-08-13
I am using DeferWindowPos to position several child windows (all have same Z-order). I need EndDeferWindowPos to generate an OnSize message each time it is called because I adjust the font based on the window size. It gets called sometimes, but not every time. Any idea why or how to fix it?

   int count = m_PaneList.Count();
   HDWP  hdwp = ::BeginDeferWindowPos(count + 1);

   
   for ( it.First(); it.IsValid(); it.Next() )
   {
      StatusWindowPane* pane = it.Object();
      if ( !pane )
         continue;
     
      pane->SetOrigin(CPoint(rc.left, rc.top));

      if ( hdwp )
            hdwp = ::DeferWindowPos( hdwp, pane->m_hWnd,  NULL, origin.x, origin.y,pane->Width(), rc.Height(),
            SWP_NOZORDER | SWP_NOACTIVATE);

      origin.x += pane->Width();
   }
   if ( hdwp )
      ::EndDeferWindowPos(hdwp);
0
Comment
Question by:drilene56
3 Comments
 
LVL 8

Accepted Solution

by:
fl0yd earned 100 total points
ID: 7150684
If insufficient system resources are available for DeferWindowPos to succeed it returns NULL. In that case you should abandon any further calls to DeferWindowPos and not call EndDeferWindowPos -- your code doesn't do either of those. The MSDN also doesn't guarantee that EndDeferWindowPos generates WM_SIZE-messages -- it generates WM_WINDOWPOSCHANGING- and WM_WINDOWPOSCHANGED-messages for all windows changed.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7375942
Dear drilene56

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "fl0yd"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7419766
Force accepted

** Mindphaser - Community Support Moderator **
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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

910 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

21 Experts available now in Live!

Get 1:1 Help Now