To be honest I have no idea but I found some code on the web and then pieced this together, and it seems to work. Tested using a single browser control on a form.
Code:
Option Explicit
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Code:
Private Sub Command1_Click()
Dim WebDC As Long
Dim Lcolor As Long
Dim hWnd1 As Long, hWnd2 As Long, hwnd3 As Long
Const strClass1 As String = "Shell Embedding"
Const strClass2 As String = "Shell DocObject View"
Const strClass3 As String = "Internet Explorer_Server"
hWnd1 = FindWindowEx(Me.hwnd, 0, strClass1, vbNullString)
hWnd2 = FindWindowEx(hWnd1, 0, strClass2, vbNullString)
hwnd3 = FindWindowEx(hWnd2, 0, strClass3, vbNullString)
WebDC = GetDC(hwnd3)
If WebDC Then
Lcolor = GetPixel(WebDC, 50, 50)
Debug.Print Lcolor ' color @ 50,50
ReleaseDC 0, WebDC
End If
End Sub
The only way I know how to do that would be to use the EnumChildWindows API function. You could find all the "Shell Embedding" classes in the form, then figure that Hwnd3 you need and add that to a listbox or array. Once you know what the order the browsers are in the listbox/array the rest should be pretty simple.
I could probably post up an example later if you're still stuck.
I realise that this post is a little old, but bim11 I can't help but want to chew you a new one... You had a valid question, and when it was answered... you erased it. Yes, given that the answers and title lead me to believe you were looking for a way to get a pixel from within a browser window, but it goes without saying, don't modify your posts when someone else could have exactly the same problem.
FYI, this was not what I was looking for, but thats besides the point.
If I have helped you out, be a pal and rate the helpful post!