Results 1 to 5 of 5

Thread: VB6 - Backcolor of a window?

  1. #1

    Thread Starter
    Hyperactive Member kazar's Avatar
    Join Date
    Apr 2006
    Location
    UK
    Posts
    323

    VB6 - Backcolor of a window?

    Hey there,

    Does anyone know if there is a function that will allow me to set and get the background colour of a window outside my application, like explorer etc

    Thanks
    KAZAR

    The Law Of Programming:

    As the Number of Lines of code increases, the number of bugs generated by fixing a bug increases exponentially.
    __________________________________
    www.startingqbasic.co.uk

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: VB6 - Backcolor of a window?

    you might wanna try GetBkColor()

  3. #3

    Thread Starter
    Hyperactive Member kazar's Avatar
    Join Date
    Apr 2006
    Location
    UK
    Posts
    323

    Re: VB6 - Backcolor of a window?

    Yeah i tried that, but when i used GetBkColor(GetDC(FindWindow(vbNullString,InputBox("Enter Window Title"))), whatever the background colour was, the number that came out would always remain the same.

    Any idea why?
    KAZAR

    The Law Of Programming:

    As the Number of Lines of code increases, the number of bugs generated by fixing a bug increases exponentially.
    __________________________________
    www.startingqbasic.co.uk

  4. #4
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: VB6 - Backcolor of a window?

    Try it with GetWindowDC instead of GetDC... not sure if it will work, but it would make more sense to get the DC of the actual window and not the client area of the window...

    GetWindowDC is actually in the same set of "Painting and Drawing Functions" on MSDN as GetBkColor, when GetDC is not...

    http://msdn.microsoft.com/library/de...tdraw_4fua.asp
    Last edited by gigemboy; Apr 15th, 2006 at 04:12 PM.

  5. #5

    Thread Starter
    Hyperactive Member kazar's Avatar
    Join Date
    Apr 2006
    Location
    UK
    Posts
    323

    Re: VB6 - Backcolor of a window?

    Thanks for that!
    KAZAR

    The Law Of Programming:

    As the Number of Lines of code increases, the number of bugs generated by fixing a bug increases exponentially.
    __________________________________
    www.startingqbasic.co.uk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width