OK, I can basically copy a window's image into another window (see code below), but can anyone tell how you get the image into a (Windows) bitmap? I've tried lots of variations on CreateCompatibleDC/Bitmap and SelectObject, but nothing works

Code: Select all
; NOTE: Currently the CopyWindow is fixed to use the dimensions of the desktop...
Procedure.w ScreenWidth ()
ProcedureReturn GetSystemMetrics_ (#SM_CXSCREEN)
EndProcedure
Procedure.w ScreenHeight ()
ProcedureReturn GetSystemMetrics_ (#SM_CYSCREEN)
EndProcedure
Procedure CopyWindow (fromWindow, toWindow, x, y)
width = ScreenWidth ()
height = ScreenHeight ()
fromDC = GetWindowDC_ (fromWindow)
toDC = GetDC_ (toWindow)
BitBlt_ (toDC, 0, 0, width, height, fromDC, x, y, #SRCCOPY)
ReleaseDC_ (toWindow, toDC)
ReleaseDC_ (fromWindow, fromDC)
EndProcedure
OpenWindow (0, 320, 200, 320, 200, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget, "Test")
Repeat
CopyWindow (GetDesktopWindow_ (), WindowID (), WindowMouseX (), WindowMouseY ())
Until WaitWindowEvent () = #PB_EventCloseWindow
End
--
See ya,
James L Boyd.
http://www.hi-toro.com/
--