2 problems: GetObjectAPI and GetCurrentObject
OK, i'm posting here, since no one seems to look at my thread in the API forum...
Problem 1:
VB Code:
Debug.Print "HDC " & GetDCEx(GetForegroundWindow, 0, DCX_WINDOW)
Debug.Print "HDC " & GetDCEx(GetDesktopWindow, 0, DCX_WINDOW)
Debug.Print "OBJ " & GetCurrentObject(GetDCEx(GetForegroundWindow, 0, DCX_WINDOW), OBJ_BITMAP)
Debug.Print "OBJ " & GetCurrentObject(GetDCEx(GetDesktopWindow, 0, DCX_WINDOW), OBJ_BITMAP)
This is what the previous code returns (on my computer):
HDC 2097221708
HDC 1610680699
OBJ 17104950
OBJ 17104950
How come the GetCurrentObject API returns the same object as the GetDesktopWindow's bitmap object ??
When I get the picture of the ForegroundWindow, it is actually the DesktopWindow, how come ?
Problem 2:
VB Code:
Dim dBitmap As Long, dBMP As BITMAP, HDC As Long, ret As Long
HDC = GetDC(GetForegroundWindow)
dBitmap = GetCurrentObject(HDC, OBJ_BITMAP)
If dBitmap <> 0 Then
ret = GetObjectAPI(dBitmap, Len(dBMP), dBMP)
Debug.Print ret, dBMP.bmHeight, dBMP.bmWidth
' .... the rest of the ode...
The GetObjectAPI ALWAYS returns 0, and dBMP variables are 0 also, how come ?