Z
ZaRMaS
Hi all,
I'm using GDI to enumerate fonts (installed or not in system) with
function EnumFonts.
My source :
AddFontResourceEx(@"C:\essai\FontTest.otf", FR_PRIVATE, IntPtr.Zero);
It returns 1 so the font is now isntalled and I send message :
SendMessage(HWND_BROADCAST, WM_FONTCHANGE, IntPtr.Zero, IntPtr.Zero);
I initialize my callback function and I create a DC
EnumFontExDelegate myefd = new EnumFontExDelegate(callback);
IntPtr dc = CreateDC("DISPLAY", null, null, IntPtr.Zero);
EnumFonts(dc, null, myefd, IntPtr.Zero);
My callback function declaration :
private int callback(ref ENUMLOGFONTEX lpelfe, IntPtr lpntme, int
FontType, int lParam)
{
return 1; //If it's 0 the callback function is called just one time
}
At this moment, my function callback is called for each font installed
(and added).
My problem is that lpelfe.elfFullName.ToString() is not empty, but it
returns "?↑?" for each fonts.
What have done wrong ?
Thank you for your help
I'm using GDI to enumerate fonts (installed or not in system) with
function EnumFonts.
My source :
AddFontResourceEx(@"C:\essai\FontTest.otf", FR_PRIVATE, IntPtr.Zero);
It returns 1 so the font is now isntalled and I send message :
SendMessage(HWND_BROADCAST, WM_FONTCHANGE, IntPtr.Zero, IntPtr.Zero);
I initialize my callback function and I create a DC
EnumFontExDelegate myefd = new EnumFontExDelegate(callback);
IntPtr dc = CreateDC("DISPLAY", null, null, IntPtr.Zero);
EnumFonts(dc, null, myefd, IntPtr.Zero);
My callback function declaration :
private int callback(ref ENUMLOGFONTEX lpelfe, IntPtr lpntme, int
FontType, int lParam)
{
return 1; //If it's 0 the callback function is called just one time
}
At this moment, my function callback is called for each font installed
(and added).
My problem is that lpelfe.elfFullName.ToString() is not empty, but it
returns "?↑?" for each fonts.
What have done wrong ?
Thank you for your help