SubClassing Problem!

This is a discussion on SubClassing Problem! within the Windows Programming forums, part of the Platform Specific Boards category; I am trying doing subclassing in Winapi. I want to change the background color when mouse is over the button. ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59

    Smile SubClassing Problem!

    I am trying doing subclassing in Winapi. I want to change the background color when mouse is over the button. But I am not getting the desired output.The code has been attached.

    I am just getting a small portion of the window to be painted red instead of the entire window that I desire.
    Any suggestions would be appreciated!
    Attached Files Attached Files

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    GetWindowRect() returns screen coords while FillRect() uses client coords.

    You also have a GDI leak.

    PS Please post code, not files.

    Only because I have finished my current project 8 weeks early (in a 13 week project) and need to kill some time, did I bother to look at your code.
    "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

  3. #3
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59
    Ok.. but I didn't post the code because the indentation was lost when I tried posting it, while my code was indented when I worked in Visual Studio. Regarding the problem, the output which I wanted from the above code, I got it without using subclassing ... So no need to answer this question now!
    Anyways thanks for replying and do tell me how to keep the indentation while posting the code here.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Use CODE tags to keep the indentation. ( square brace 'code' square brace to open then square brace '/code' square brace to close)

    Code:
                        leading spaces and TABs are retained inside code tags
    "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. Subclassing
    By alex0751 in forum C++ Programming
    Replies: 2
    Last Post: 01-21-2008, 05:39 PM
  2. Problem with Listbox and Subclassing
    By KonArtis in forum Windows Programming
    Replies: 3
    Last Post: 10-20-2004, 05:47 AM
  3. Subclassing Problem
    By Thunder in forum Windows Programming
    Replies: 4
    Last Post: 10-22-2003, 03:49 PM
  4. Subclassing edit control - slight problem
    By Shag in forum Windows Programming
    Replies: 3
    Last Post: 11-02-2002, 11:33 PM
  5. Subclassing
    By dhirst2880 in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2002, 10:25 AM

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