Window Class Help
wc.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
I am having trouble understanding what this does. I know wc.hbrBackground is the window class and (HBRUSH) GetStockObject (WHITE_BRUSH); is getting assigned to the wc.hbrBackground. but what does the (HBRUSH) do? I believe (HBRUSH) is a structure but I haven't seen a structure accessed like that before. Thanks
The stuff you showed changes the background color of the window.
I know it changes the background of the window. I mean what is (HBRUSH) is it a structure or what? I am not content with just know what the whole line of code does I wanna know every part of it.
GetStockObject() returns a handle to an object. The object is usually a GDI (grapical device interface) resource. That is a piece of memory relating to a brush, pen or font ect.
In your example you called for the standard white brush. This is not a structure but more a pointer to memory holding the information on the brush. ie its thickness, colour, pattern ect.
The (HBRUSH) is a type cast to ensure that the right type of data (handle to a brush) is passed to the element of the windclass struct.