Solved

WM_MOVE and WM_SHOWWINDOW

Posted on 1998-10-13
4
688 Views
Last Modified: 2013-11-20
I am writing some code to acquire data through a port and plot it on screen in real time, more or less.  I am trying to keep the amount of code to a minimum for performance.  In my OnDraw function I separate the axes, gridlines, and labels from the code that plots the data so that the more permanent features are not regenerated every time.  I use a boolean flag to indicate when these features are to be redrawn.  
      A problem arises when I move a window over another view.  The background is redrawn when I reveal the window again, but none of my graphics, because the flag has not been set high to indicate that they should be redrawn.  So I am trying to set the flag in the handlers for the various windows events such as OnSize, OnMove, and OnShowwindow.  The only one of these that works is the OnSize handler.  So my graphics are regenerated when I resize a window, but not when I move it or when i minimize then restore it. Are there no WM_MOVE messages sent when I move a window?  

More importantly, is my method appropriate, or should I be calculating a rectangle to invalidate for every data point that comes in.  Or should I do both things?

I am giving away most of my points for some seemingly easy questions because I  expect I will be following up a bit.  I want an understanding of what is happening, for instance, when I slide a dialog box across my view and everything under the box is erased.
0
Comment
Question by:akuru
[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
  • 2
  • 2
4 Comments
 

Author Comment

by:akuru
ID: 1323266
Edited text of question
0
 
LVL 3

Accepted Solution

by:
plaroche earned 200 total points
ID: 1323267
The thing that is happening is that your unflagged regions are marked as invalidated by the system when another window is moved over.
Not only should you check for your boolean flag but you should also check if your axis region, for example, is included in the invalidated region.
To get the invalidated region you can use CDC::GetClipBox, then you will need to check if your rect is in that region. For that you can use CRect::IntersectRect.

0
 

Author Comment

by:akuru
ID: 1323268
I figured that the system was invalidating the part of the view that is hidden.  The question then becomes: by what mechanism does the system alert the view that it now has an invalid region caused by the view being obscured by something else?  If part of my view is hidden, portions of the axes and or gridlines will almost certainly be in the invalid rectangle.  The only time an invalid region will not include the more permanent features is when the invalidation occurs from a new data point.

In my OnSize, I set the m_bRedraw flag high, and my OnDraw function redraws everything, scaling it appropriately.  Where can I set that flag high when part of my view is invalidated by another window overlapping it?  Or when a window is restored from being minimised?  
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1323269
You view will get a OnDraw when the system has invalidated it, it comes by naturally. This is the place where the region check should take place, and then maybe set your flags high.

The check for the invalidated region will treat all cases of maximization, etc... because it's where every drawing occurs.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

734 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