Delphi Incompatible type tagLOGBRUSH tagLOGBRUSH32
When using Delphi XE2 or above editions to compile coeds likes below:
1
2
3
4
5
|
procedure VEMRCREATEBRUSHINDIRECT(Data: PEMRCreateBrushIndirect);
begin
GDIObjects[Data^.ihBrush] := CreateBrushIndirect(Data^.lb);
//GDIObjects and CreateBrushIndirect are defined in the winapi.windows unit.
end;
|
The compiler says: E2010 Incompatible types: ‘tagLOGBRUSH’ and ‘tagLOGBRUSH32’. The solution to fix this compiling error is:
1
2
3
4
5
6
7
8
9
|
procedure VEMRCREATEBRUSHINDIRECT(Data: PEMRCreateBrushIndirect);
var
LogBrush: TLogBrush;
begin
LogBrush.lbStyle := Data^.lb.lbStyle;
LogBrush.lbColor := Data^.lb.lbColor;
LogBrush.lbHatch := Data^.lb.lbHatch;
GDIObjects[Data^.ihBrush] := CreateBrushIndirect(LogBrush);
end;
|