So mostly I blog about WPF, which is where I’ve spent most of my time the last few years.  But I also work on USER and GDI, along with many full-time USER & GDI'ers, and wanted to spend a little time talking about compatibility.  We put a lot of effort into compatibility, and Windows Vista runs most software written for Windows XP without a hitch.  But absolute 100% compatibility isn’t possible (especially in a beta!), and we’d like your help and feedback.  Does your application work on Windows Vista?  Can you change it to work?  Do you need us to make changes?  How do you think we’re doing on compatibility?

We recently published which describes common compatibility hotspots in Windows Vista.  Good document, but it doesn’t talk a lot about USER and GDI (yet – I’m working on it <g>).  So in the meantime, thought I’d write a few things about USER and GDI-specific issues.

Part 1 -- Painting issues

As part of the Desktop Window Manager work, we’ve made subtle but important changes to the way applications paint to the screen.  Prior to Windows Vista, hwnds painted directly to the screen, which had certain benefits but really limited how Windows could display and manage top-level windows.  In Windows Vista, all top-level windows are rendered to an offscreen bitmap (similar to WS_EX_LAYERED), and the desktop window manager combines the images together to draw the desktop.

Things to pay attention to when testing:

  • Black areas around tool tips, pop-up menus, balloons, splash screens, etc. -- This can happen when the application has not painted the entire hwnd, usually because that application assumed that the pixels in the background windows are good enough.  This is an area we’re actively doing work on, so don’t overly optimize based on current bits but please give us the feedback.
  • Flashes of black – A related issue happens when applications do painting that's not part of a WM_PAINT.  USER detects the application is drawing and redraws the desktop, but the application may not have finished drawing the hwnd when that happens, and the result is the backing bitmap contains uninitialized pixels (black).  Again, we’re actively working here so please give us feedback on where you think we need to improve.
  • Glass disabled for application -- this can happen when an application draws to the non-client area of the window (the title bar)
  • Rubber bands, custom shadows, and other special effects – these are often done using GetDC(NULL), however reading and writing to GetDC(NULL) tends to be problematic when applications are backed by a bitmap rather than drawing straight to the screen. Reading and writing to the screen is significantly slower than Windows XP.  Also, not all GDI rasterops are supported (but we do support XOR).
  • Improved Far East fonts – Windows Vista has made numerous changes to the Chinese, Japanese, and Korean fonts to make them more readable; one of the side effects is that text can layout slightly differently in these new fonts as characters may have different widths.  Consider testing how your text lays out on the screen and on the printer.  Also consider testing places where Far East languages can be mixed with Latin character sets (e.g. English).

A lot of this is DWM-related, Greg Schector's blog is a great place for background info on DWM.

Next up: performance differences