?
Solved

DeferWindowPos doesn't always cause OnSize message

Posted on 2002-07-09
3
Medium Priority
?
566 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
[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 8

Accepted Solution

by:
fl0yd earned 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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.

764 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