Window Class Help

This is a discussion on Window Class Help within the Windows Programming forums, part of the Platform Specific Boards category; wc.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH); I am having trouble understanding what this does. I know wc.hbrBackground is the window class and (HBRUSH) ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    66

    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

    Ryan

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post I think...

    The stuff you showed changes the background color of the window.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    66
    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.

    Ryan

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    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.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 02:22 PM
  3. how i create a window whith all it's elements
    By rasheed in forum Windows Programming
    Replies: 1
    Last Post: 05-31-2006, 06:53 PM
  4. Window Wrapper Class, WM_NCCREATE never sent
    By bennyandthejets in forum Windows Programming
    Replies: 5
    Last Post: 04-18-2004, 06:02 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21