Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Continuous stream of WM_PAINT messages to main form in Windows 7

$
0
0

Hi,

I'm facing a very strange issue in Windows 7 64 bit machine. I have an application which runs perfectly fine on Windows XP. Recently, I had to port this application to Windows 7 which we did successfully. Everything works as expected, but my main UI (form) get  continuous stream of WM_PAINT message. After very long analysis identified the root cause. In my application, I have overridden CreateParams property of main form to avoid the flickering issue (code is given below). Somehow, this causes the continuous stream of WM_PAINT messages to main form. Application works fine(with flickering, but continuous WM_PAINT stopped) after commenting our this code part.

protected override CreateParams CreateParams

{

   get

   {

      CreateParams cp = base.CreateParams;

      cp.ExStyle |= 0x02000000; //WS_EX_COMPOSITED

      return cp;

   }

}

I have created a sample application and attached with this post which reproduces the problem quite easily. Do following steps to reproduce the issue

  • Run the application and Spy main UI using Spy++ with all messages enabled.
  • Select the the property grid from the form
  • Continous stream of WM_PAINT happens.

I would like to know couple of things:

  1. What is the real root cause of this problem ? (I have fair understanding on the difference in UI rendering in both XP & Win7. I would like to know the reasons beyond that.)
  2. How can I solve this issue ? (Any solution which won’t cause UI flickering and continuous WM_PAINT messages will help.)

Any help in this regard will be much appreciated.

Thanks



Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>