- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Has the function SETDCBRUSHCOLOR been deprecated and if so how do you change the brush color?
Thanks,
Brooks
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page