The Image disappears after 5 seconds...
Code: Select all
; Desktop Copy Function
; No Image after 5 seconds.
;
Procedure CaptureScreen(Left.l, Top.l)
DC.l = GetDC_(0)
MemDC.l = CreateCompatibleDC_(DC)
BmpID.l = CreateCompatibleBitmap_(DC, 200, 200)
SelectObject_( MemDC, BmpID)
BitBlt_( MemDC, 0, 0, 200,200, DC, Left, Top, #SRCCOPY)
;Bitmap = GetCurrentObject_(MemDC,#OBJ_BITMAP) ;used with ProcedureReturn Bitmap
;DeleteObject_(BmpID) ;used with ProcedureReturn Bitmap
DeleteDC_( MemDC)
ReleaseDC_(0,DC)
;ProcedureReturn Bitmap ;same BUG if Bitmap or BmpID is used...
ProcedureReturn BmpID ;same BUG if Bitmap or BmpID is used...
EndProcedure
;
If OpenWindow(0,200,200,200,200,#PB_Window_SystemMenu,"Loupe") : Else : End : EndIf
If CreateGadgetList(WindowID()) : Else : End : EndIf
;
CursorPosition.POINT
hImage = CaptureScreen( CursorPosition\x, CursorPosition\y)
hGadget = ImageGadget(0, 0, 0, 200,200, hImage)
;
Repeat
EventID.l = WaitWindowEvent() ;same BUG if WaitWindowEvent or WindowEvent is used
;EventID.l = WindowEvent() ;same BUG if WaitWindowEvent or WindowEvent is used
;Delay(10) ;used for WindowEvent
GetCursorPos_(CursorPosition)
hImage = CaptureScreen( CursorPosition\x, CursorPosition\y)
SendMessage_(hGadget, #STM_SETIMAGE, #IMAGE_BITMAP, hImage)
Until EventID=#PB_EventCloseWindow
;
End
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 12 June 2002 19:48:26
