Re: Font for static label

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Rhett Gong [MSFT] (v-raygon_at_online.microsoft.com)
Date: 04/20/04


Date: Tue, 20 Apr 2004 08:16:11 GMT


>"Handles to GDI objects are private to a process.
>That is, only the process that created the GDI object can use the
>object handle. "
GDI objects are stored in the client part of the Win32 subsystem's GDI module. That means that any GDI object is valid only
in the context of the application that created it.
However, handles to GDI objects are internally implemented as offsets into a handle table that resides on the client side of
the Win32 subsystem. In other words, handle tables are kept on a per-process basis, but they are not process-tagged.

SelectObject selects *an object into* the specified device context (DC). That means it will use the GDI object from other AP
directly, it certainly causes an failure (As you find in SelectObject,there is an explicit test for whether the object
belongs to the calling process.). But GetObject just retrieves *information* for the specified graphics object.And in the
later use, we create the font with the information we get from the another application's font object. So it is OK to use
"WM_GETFONT-GetObject()-CreateFontIndirect()-WM_SETFONT.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.