Results 1 to 3 of 3

Thread: Get the color of a control

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Location
    Guayaquil, Guayas, Ecuador
    Posts
    87

    Question

    How can i get the Back color of a control that is in an external app.
    I have the hwnd of that control.

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    try these

    Code:
    Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
    Private Declare Function GetBkColor Lib "gdi32" Alias "GetBkColor" (ByVal hdc As Long) As Long
    
    Private Function getcol(hWnd As Long) As Long
    
        getcol = GetBkColor( GetDC(hWnd))
    
    End Function

    If it wasn't for this sentence I wouldn't have a signature at all.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Location
    Guayaquil, Guayas, Ecuador
    Posts
    87
    It works for some controls like picturebox and forms but it doesn't work for others like textbox buttons etc.

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