The VO app that I am converting to X# has the following code:
Code: Select all
_DLL FUNCTION EnumFontFamiliesEx(hDC AS PTR, lpLogFont AS _winLOGFONT, lpEnumFontFamExProc AS PTR, lParam AS DWORD, dwFlags AS DWORD) AS DWORD PASCAL:GDI32.EnumFontFamiliesExA
Code: Select all
FUNCTION EnumFontFamExProc(lpelfe AS _winENUMLOGFONTEX, lpntme AS _winNEWTEXTMETRICEX, FontType AS DWORD, lParam AS LONG) AS INT CALLBACK
AAdd(aFontFamilies, {Psz2String(@lpelfe.elfFullName), Psz2String(@lpelfe.elfStyle), Psz2String(@lpelfe.elfScript)})
RETURN 1
Code: Select all
LOCAL struLF IS _winLOGFONT
struLF.lfCharSet := DEFAULT_CHARSET
EnumFontFamiliesEx(GetDC(SELF:Handle()), @struLF, @EnumFontFamExProc(), 0, 0) // error
Error XS9052: "In .Net you cannot take the address of a method or a function. For callback functions you need to use a delegate instead."
I have read the topic "DELEGATE Statement" in the X# runtime documentation, I have also searched the forums and found a few topics relating to bBrowser that mention this error, but I still do not understand how exactly I should rewrite the EnumFontFamiliesEx call to make it work.
Kees.