Hfont g_hfont;
Uint wm_sh_uimetric_change;
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------
Void createhintfont ()
{
If (g_hfont)
{
Deleteobject (g_hfont );
}
DWORD dwrequired;
Long dwfontsize = 12;
Shgetuimetrics (shuim_fontsize_pixel, & dwfontsize, sizeof (dwfontsize), & dwrequired );
Logfont lf;
Memset (& lf, 0, sizeof (LF ));
_ Tcscpy (LF. lffacename, _ T ("Courier New "));
Lf. lfheight =-dwfontsize;
Lf. lfweight = fw_normal;
G_hfont = createfontindirect (& lf );
}
Certificate ------------------------------------------------------------------------------------------------------------------------------------------
Lresult winapi msgproc (hwnd, uint MSG, wparam, lparam)
{
If (MSG = wm_sh_uimetric_change)
{
Createhintfont ();
}
Else switch (MSG)
{
Case wm_paint:
{
Paintstruct pt; // if the pointer type is not used, you need to take the address to pass the parameter.
Rect;
Hdc dc;
Getclientrect (hwnd, & rect );
Dc = beginpaint (hwnd, & pt );
Settextcolor (DC, fontcolor );
SelectObject (DC, g_hfont );
Setbkmode (DC, transparent );
Drawtext (DC, text ("your text information"),-1, & rect, dt_left | dt_vcenter );
Break;
}
Default:
Return defwindowproc (hwnd, MSG, wparam, lparam );
}
Return 0;
}
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------
/// // After the window is created
Createhintfont ();
Wm_sh_uimetric_change = registerwindowmessage (sh_uimetric_change );