Re: Remove Window Flicker
Posted: Wed Jun 06, 2012 7:08 pm
I removed the GrabImage and the ImageGadget altogether and it still wobbles:
Code: Select all
Procedure MoveWindow(void)
Repeat
If GetAsyncKeyState_(#VK_LBUTTON)&32768
xpos = WindowX(0)
ypos = WindowY(0)
hDCin = CreateCompatibleDC_(0)
SelectObject_(hDCin, ImageID(1))
hDCout = StartDrawing(WindowOutput(0))
BitBlt_(hDCout, 0, 0, 200, 200, hDCin, xpos, ypos ,#SRCCOPY)
StopDrawing()
DeleteDC_(hDCin)
EndIf
Delay(1)
ForEver
EndProcedure
Procedure OpenWindowMagnify()
If OpenWindow(0, 0, 0, 200, 200, "Magnify", #PB_Window_ScreenCentered|#PB_Window_BorderLess)
; SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, #WS_EX_LAYERED)
; SetLayeredWindowAttributes_(WindowID(0), 0, #Null, #LWA_COLORKEY)
StickyWindow(0, 1)
Region = CreateEllipticRgn_(0, 0, 200, 200)
SetWindowRgn_(WindowID(0), Region, #True)
DeleteObject_(Region)
EndIf
EndProcedure
UseJPEGImageDecoder()
LoadImage(1, "C:\test.jpg")
OpenWindowMagnify()
GrabImage(1, 2, WindowX(0), WindowY(0), 200, 200)
hDCin = CreateCompatibleDC_(0)
SelectObject_(hDCin, ImageID(1))
hDCout = StartDrawing(WindowOutput(0))
BitBlt_(hDCout, 0, 0, 200, 200, hDCin, WindowX(0), WindowY(0) ,#SRCCOPY)
StopDrawing()
DeleteDC_(hDCin)
CreateThread(@MoveWindow(),0)
Repeat
Select WaitWindowEvent()
Case #WM_LBUTTONDOWN
SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, #Null)
Case #WM_LBUTTONDBLCLK
CloseWindow(0)
FreeImage(1)
End
EndSelect
ForEver