Hi *.*,
I have to determine al least the size, better name and size
of the currently selected font of an ownerdrawn listbox in a
foreign application, e.g. User Manager in WinNT4. How can
this be done?
Juergen.
Printable View
Hi *.*,
I have to determine al least the size, better name and size
of the currently selected font of an ownerdrawn listbox in a
foreign application, e.g. User Manager in WinNT4. How can
this be done?
Juergen.
"Juergen Thuemmler" <thue@gmx.de> wrote in message
news:3d73aa3d@10.1.10.29...
> Hi *.*,
>
> I have to determine al least the size, better name and size
> of the currently selected font of an ownerdrawn listbox in a
> foreign application, e.g. User Manager in WinNT4. How can
> this be done?
>
> Juergen.
Juergen -
At a guess, you could use GetDC(hWnd) to get the Device Context handle, and
then GetCurrentObject(hDC, OBJ_FONT) to get the current hFont. However,
this might not necessarily get you the true Font, if the owner-draw code
uses SelectObject() to change the font when responding to the WM_PAINT
message. Also, I am not sure how to get back from a physical font
(represented by hFont), and a logical font (represented by a LOGFONT
structure). You could try GetOutlineTextMetrics(), which returns an
OUTLINETEXTMETRIC structure, of which the otmpFaceName member may be what
you want.
--
Mark Alexander Bertenshaw
Programmer/Analyst
Chordiant Software, Inc.
Brentford
UK
Mark,
> At a guess, you could use GetDC(hWnd) to get the Device Context handle,
and
> then GetCurrentObject(hDC, OBJ_FONT) to get the current hFont. However,
> this might not necessarily get you the true Font, if the owner-draw code
> uses SelectObject() to change the font when responding to the WM_PAINT
> message. Also, I am not sure how to get back from a physical font
> (represented by hFont), and a logical font (represented by a LOGFONT
> structure). You could try GetOutlineTextMetrics(), which returns an
> OUTLINETEXTMETRIC structure, of which the otmpFaceName member may be what
> you want.
thanks for reply. Until now, I tried to avoid to use these functions ;-)
I'm not sure about using functions which use pointers to structures in a
foreign
process. Sometimes it works, sometimes it crashes ...
Well, there would be the possibility to hook into the foreign process using
a Dll,
but this seems to be overdone for this purpose ...
Anyway, I'll check your proposal.
Thanks!
Juergen.
WM_GETFONT may work better than GetDC/GetCurrentObject, depending on how the
ownerdraw was implemented. It doesn't help with the hFont->LOGFONT
derivation, however. -Matt
"Mark Alexander Bertenshaw" <mark.bertenshaw@virgin.net> wrote in message
news:3d74700f$1@10.1.10.29...
> "Juergen Thuemmler" <thue@gmx.de> wrote in message
> news:3d73aa3d@10.1.10.29...
> > Hi *.*,
> >
> > I have to determine al least the size, better name and size
> > of the currently selected font of an ownerdrawn listbox in a
> > foreign application, e.g. User Manager in WinNT4. How can
> > this be done?
> >
> > Juergen.
>
> Juergen -
>
> At a guess, you could use GetDC(hWnd) to get the Device Context handle,
and
> then GetCurrentObject(hDC, OBJ_FONT) to get the current hFont. However,
> this might not necessarily get you the true Font, if the owner-draw code
> uses SelectObject() to change the font when responding to the WM_PAINT
> message. Also, I am not sure how to get back from a physical font
> (represented by hFont), and a logical font (represented by a LOGFONT
> structure). You could try GetOutlineTextMetrics(), which returns an
> OUTLINETEXTMETRIC structure, of which the otmpFaceName member may be what
> you want.
>
> --
> Mark Alexander Bertenshaw
> Programmer/Analyst
> Chordiant Software, Inc.
> Brentford
> UK
>
>