R.Wieser
2021-04-03 08:25:29 UTC
Hello all,
I'm currently playing around with giving a dialog different colors than the
standard one, and have ran into a bit of a problem:
I want to mix using the results of CreateSolidBrush and GetSysColorBrush.
The thing is that while the latter handles do need to be deleted, the former
ones must be (otherwise GDI resource leakage will occur).
While calling DeleteObject on a GetSysColorBrush handle doesn't do anything,
accidentily prematurily deleting a CreateSolidBrush handle causes "bad
things" to happen.
So:
tl;dr:
I would like to cache (lock?) my CreateSolidBrush handle just like the
GetSysColorBrush handle is said to be. How do I do that ?
Regards,
Rudy Wieser
P.s.
I tried to take a peek into the CreateSolidBrush result handle (in an
attempt to compare the cached and non-cached brush in search for a "lock"
bit), but alas, it seems to be stored somewhere where I am not allowed to
even look at it ....
I'm currently playing around with giving a dialog different colors than the
standard one, and have ran into a bit of a problem:
I want to mix using the results of CreateSolidBrush and GetSysColorBrush.
The thing is that while the latter handles do need to be deleted, the former
ones must be (otherwise GDI resource leakage will occur).
While calling DeleteObject on a GetSysColorBrush handle doesn't do anything,
accidentily prematurily deleting a CreateSolidBrush handle causes "bad
things" to happen.
So:
tl;dr:
I would like to cache (lock?) my CreateSolidBrush handle just like the
GetSysColorBrush handle is said to be. How do I do that ?
Regards,
Rudy Wieser
P.s.
I tried to take a peek into the CreateSolidBrush result handle (in an
attempt to compare the cached and non-cached brush in search for a "lock"
bit), but alas, it seems to be stored somewhere where I am not allowed to
even look at it ....