Solved

DeferWindowPos doesn't always cause OnSize message

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

739 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