Results 1 to 17 of 17

Thread: 2 problems: GetObjectAPI and GetCurrentObject

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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:
    1. Debug.Print "HDC " & GetDCEx(GetForegroundWindow, 0, DCX_WINDOW)
    2.     Debug.Print "HDC " & GetDCEx(GetDesktopWindow, 0, DCX_WINDOW)
    3.    
    4.     Debug.Print "OBJ " & GetCurrentObject(GetDCEx(GetForegroundWindow, 0, DCX_WINDOW), OBJ_BITMAP)
    5.     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:
    1. Dim dBitmap As Long, dBMP As BITMAP, HDC As Long, ret As Long
    2.    
    3.     HDC = GetDC(GetForegroundWindow)
    4.     dBitmap = GetCurrentObject(HDC, OBJ_BITMAP)
    5.    
    6.     If dBitmap <> 0 Then
    7.         ret = GetObjectAPI(dBitmap, Len(dBMP), dBMP)
    8.         Debug.Print ret, dBMP.bmHeight, dBMP.bmWidth
    9.  
    10. ' .... the rest of the ode...
    The GetObjectAPI ALWAYS returns 0, and dBMP variables are 0 also, how come ?
    Last edited by CVMichael; Feb 4th, 2003 at 12:58 PM.

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