Solved

DeferWindowPos doesn't always cause OnSize message

Posted on 2002-07-09
3
537 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

759 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

18 Experts available now in Live!

Get 1:1 Help Now