Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
43 Views

SETDCBRUSHCOLOR

Has the function SETDCBRUSHCOLOR been deprecated and if so how do you change the brush color?

Thanks,

Brooks

0 Kudos
2 Replies
Highlighted
Black Belt Retired Employee
43 Views

No, it hasn't. It ought to be defined in module GDI32, but isn't. You can define your own interface, for example:

interface
function SetDCBrushColor (hdc,color) BIND(C,NAME="SetDCBrushColor")
!DEC$ ATTRIBUTES DEFAULT, STDCALL :: SetDCBrushColor
use IFWINTY
integer(ULONG) :: SetDCBrushColor
integer(HANDLE), intent(IN), value :: hdc
integer(ULONG), intent(IN), value :: color
end function SetDCBrushColor
end interface

 

0 Kudos
Highlighted
Valued Contributor I
43 Views

Interesting...  I use CreateSolidBrush(), which is defined in GDI32, works perfectly.  Note that with this API you have to explicitly clean up with DeleteObject(hbrush) when done.  The MSDN chat on SetDCBrushColor is unclear (to me, at least) about who does the memory management when a stock system brush is replaced with a user brush, so be careful not to create small memory leaks which would be difficult to detect.

0 Kudos