@Christoph De Vocht
This may be of no use to you but I just used the BitBlt function and it captured the button states just fine. I’ve been working with these functions for days now so I thought I’d just throw it out there for you.
[code]
Function CaptureRect(HWND As Int32, X As Integer, Y As Integer, Width As Integer, Height As Integer) As Picture
#If TargetWin32 Then
Declare Function GetDesktopWindow Lib “User32” () As Integer
Declare Function GetDC Lib “User32” (HWND As Integer) As Integer
Declare Function BitBlt Lib “GDI32” (DCdest As Integer, xDest As Integer, yDest As Integer, Width As Integer, _
Height As Integer, DCsource As Integer, xSource As Integer, ySource As Integer, rasterOp As Integer) As Boolean
Declare Function ReleaseDC Lib “User32” (HWND As Integer, DC As Integer) As Integer
Const SRCCOPY = &h00CC0020
Const CAPTUREBLT = &h40000000
If Width = 0 Or Height = 0 Then Return Nil
Dim img As Picture = New Picture(Width, Height, 32)
Dim SourceDC As Integer = GetDC(HWND)
Dim DestDC As Integer = img.Graphics.Handle(img.Graphics.HandleTypeHDC)
Call BitBlt(DestDC, x, y, Width, Height, SourceDC, x, y, SRCCOPY Or CAPTUREBLT)
Call ReleaseDC(HWND, SourceDC)
Return img
End Function
#Endif[/code]
I put this in a button action event.
p = CaptureRect(me.Handle,0,0,me.Width,me.Height)