Results 1 to 4 of 4

Thread: Obtain Background Color of a Control

  1. #1

    Thread Starter
    Addicted Member cbond's Avatar
    Join Date
    Apr 2001
    Location
    AZ - USA
    Posts
    148

    Obtain Background Color of a Control

    How do I obtain the background color of a control (that I have already identified) that is a part of another seperate window/application?

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    You could use the GetBkColor API, but it accepts a device context as an aurgument, so you'll need to convert the hwnd you've got with the GetDC API.

  3. #3

    Thread Starter
    Addicted Member cbond's Avatar
    Join Date
    Apr 2001
    Location
    AZ - USA
    Posts
    148
    Thank you!! That is what I needed. I am getting some unexpeded results from it. All the background colors are being retuned as white. The app I am testing it on is simply a VB form with several text boxes, some command buttons and a combo box.

    I'll keep playing with it to see what it is doing, but if you know of any querks that accompany this call. Thanks again for your help.

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Here's a little form I knocked up. Change the picturebox's colour to anything and it should give you consistent answers when you click the button
    Attached Files Attached Files

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