Hi everyone, IŽm too stupid for Windows. Before drawing text on a bitmap, I need to know the handle of the selected font, specified by name, say 'Arial'. This is my last attempt. Anybody knows, where IŽm still wrong?
function CallbackProc( var AFontInfoVar : TEnumLogFont; var AMetricVar : TNewTextMetric; AFontType : DWORD; FontInfo : TLogFont) : Integer stdcall; begin AMetricVar := AMetricVar; // avoid FPC hint 'not used' AFontType := AFontType; // dito FontInfo := AFontInfoVar.elfLogFont; Result := 0; // assume success and stop enumeration end; function GetFontHandle( const AFontName : String) : hFont; var FontInfo : TLogFont; begin EnumFontFamilies( DeviceContext, PChar(AFontName), @CallbackProc, LongInt(nil + @FontInfo) ); Result := CreateFontIndirect(@FontInfo); end; Thanks in advance Wolfram _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal