Results 1 to 4 of 4

Thread: GetObjectAPI

  1. #1

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

    GetObjectAPI

    VB Code:
    1. Dim dBitmap As Long, dBMP As BITMAP, HDC As Long, ret As Long
    2.    
    3.     HDC = 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 ?

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    You get a hwnd from GetForegroundWindow...
    Code:
        Dim dBitmap As Long, dBMP As BITMAP, HDC As Long, ret As Long
        
        HDC = GetForegroundWindow
        HDC=GetDC(HDC) 
        dBitmap = GetCurrentObject(HDC, OBJ_BITMAP)
        
        If dBitmap <> 0 Then
            ret = GetObjectAPI(dBitmap, Len(dBMP), dBMP)
            Debug.Print ret, dBMP.bmHeight, dBMP.bmWidth

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    I just forgot to copy that line, when I copyed and pasted the code in this thread.

    So, my question is the same: how come it's always 0 ?

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    Actually, in this thread wich I posted in the general forum is more detailed

    http://vbforums.com/showthread.php?s=&threadid=228589

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