Restored from previous forum. Originally posted by Franco.
Hi PB,
that's strange.
I have @work 'Win2000 Sp3' and both of the following codes worked fine (Loupe).
This code uses DrawImage:
Code: Select all
; (c) 2002 - Franco's template - absolutely freeware
; Thank's Pupil for the hint :)
; Desktop Loupe Function
;
Procedure CaptureScreen(Left.l, Top.l,Factor.l)
DC.l = GetDC_(0)
MemDC.l = CreateCompatibleDC_(DC)
BmpID.l = CreateImage(0, 200, 200)
SelectObject_( MemDC, BmpID)
StretchBlt_( MemDC, 0, 0,200*Factor,200*Factor, DC,Left, Top, 200, 200, #SRCCOPY )
DeleteDC_( MemDC)
ReleaseDC_(0,DC)
ProcedureReturn BmpID
EndProcedure
;
If OpenWindow(0,200,200,200,200,#PB_Window_SystemMenu,"Loupe") : Else : End : EndIf
;
CursorPosition.POINT
StartDrawing(WindowOutput())
;
Repeat
EventID.l = WindowEvent()
Delay(10)
GetCursorPos_(CursorPosition)
hImage = CaptureScreen( CursorPosition\x - 24,CursorPosition\y - 24,4)
DrawImage(hImage, 0, 0)
Until EventID=#PB_EventCloseWindow
;
End
This code uses ImageGadget:
Code: Select all
;The picture changes the same instant i move the mouse...
;Well, we'll just have to try another one, here's another one that works for me:
;
Procedure CaptureScreen(Left.l, Top.l)
DC.l = GetDC_(0)
MemDC.l = CreateCompatibleDC_(DC)
; FreeImage(0)
BmpID.l = CreateImage(0, 200, 200); CreateCompatibleBitmap_(DC, 200, 200)
SelectObject_( MemDC, BmpID)
; BitBlt_( MemDC, 0, 0, 200,200, DC, Left, Top, #SRCCOPY)
StretchBlt_( MemDC, 0, 0,200*2,200*2, DC,Left, Top, 200, 200, #SRCCOPY )
DeleteDC_(MemDC)
ReleaseDC_(0,DC)
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
These are only examples (older ones) to show you that it works fine on W2K(Sp3).
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.