Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WM_MOVE and WM_SHOWWINDOW

Posted on 1998-10-13
4
Medium Priority
?
701 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 600 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Loops Section Overview
Suggested Courses

885 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