Solved

WM_MOVE and WM_SHOWWINDOW

Posted on 1998-10-13
4
685 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
  • 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

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 73
Looking for a specific application/software 2 119
bigDiff challenge 17 135
no14 challenge 14 73
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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