Solved

WM_MOVE and WM_SHOWWINDOW

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
paragon account problem 9 96
iSeries FTP Exit Program 8 114
List out all word 7 224
Smart Camera scanning and reading information 3 86
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now