Solved

WM_MOVE and WM_SHOWWINDOW

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 56
fizzArray  challenge 1 58
NotAlone Challenge 20 79
Modbus - whats the maximum I can store in one register? 4 78
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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

910 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

18 Experts available now in Live!

Get 1:1 Help Now