Article ID: 319261 - View products that this article applies to.
This article was previously published under Q319261
Graphics that are rendered by GDI+ cannot be magnified by screen magnifiers. This issue affects any program that uses GDI+, including Microsoft Office XP, Microsoft Visio 2002, Microsoft .NET Framework, and the Windows shell.
GDI+ uses a mechanism that is named DCI to render directly into the front buffer. GDI+ does not generate GDI DDI calls when it renders in this manner. However, screen magnifiers work by assuming that all rendering occurs through GDI. Screen magnifiers hook the GDI DDI calls, capture all rendering into an offscreen bitmap, and draw a portion of that bitmap magnified on the screen.
If a screen magnifier runs with a program that uses GDI+, some portions of the screen are drawn magnified and some portions are drawn unmagnified.
To resolve this problem, obtain the latest service pack for Windows XP. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
322389To resolve this problem, obtain the update that is mentioned in the following Microsoft Knowledge Base article:
(http://support.microsoft.com/kb/322389/EN-US/ )How to Obtain the Latest Windows XP Service Pack
(http://support.microsoft.com/kb/318966/EN-US/ )Problems Viewing, Editing, or Printing Some Images in Windows XP
For Program DevelopersIf you are a program developer, you must update your program so that it tells GDI+ to use GDI instead of DCI for rendering. Each GDI+ instance contains a hidden top-level window whose title is "GDI+ Window" and whose class name is GDI+ Hook Window Class. When you install the update that is described in article Q318966, the GDI+ hidden window listens for a private window message that is named "GDI+ Accessibility." If the GDI+ hidden window receives this message, it stops using DCI for rendering and starts using GDI instead. This makes GDI+ work correctly with screen magnifiers.
When a screen magnifier loads, it must register a private window message that is named "GDI+ Accessibility." GDI+ registers a private message of the same name, so the magnifier can communicate with GDI+ by using this message. The magnifier must then scan all existing top-level windows. If the magnifier finds any windows that are named "GDI+ Window" and whose class name is GDI+ Hook Window Class, the magnifier must send the "GDI+ Accessibility" message to those windows. This makes any existing GDI+ programs magnify correctly.
The screen magnifier must also watch for any new GDI+ programs that are loaded after it starts. The magnifier can do this by setting a callback function by using SetWinEventHook that is called every time a new window is created. If a new window is created with the correct title and class name, the magnifier must send the "GDI+ Accessibility" message to it.
Note that after a particular instance of GDI+ begins using GDI instead of DCI to render, it cannot switch back to using DCI unless the program is quit and restarted. GDI+ renders more slowly by using GDI than it does by using DCI. If the user no longer requires a magnifier with GDI+ and wants to increase rendering performance, the user can restart the GDI+ program.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Windows XP Service Pack 1.
The following sample program demonstrates how to use the new GDI+ functionality in your program. Include the Gdipacs.c and Gdipacs.h files in your project. You must call GDIPlusDCIOff_Init when your program starts. This causes all existing GDI+ programs to stop rendering by using DCI, and it causes any new GDI+ programs that are loaded not to use DCI to render. You must call GDIPlusDCIOff_Uninit when your program quits. Existing GDI+ programs cannot revert to using DCI, but new GDI+ programs will use DCI as they typically do.
The Testmain.c file demonstrates this functionality. Compile and run the file to test the "GDI+ Accessibility" message with your GDI+ programs.
Sample CodeMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
Article ID: 319261 - Last Review: May 21, 2007 - Revision: 4.7
Contact us for more help