For the sake of the argument let us assume Win10 with a resolution of 1920x1080 and a scaling set to 125%
I am trying to get some API-function with a fading effect working, but it will not work "centered", it always shows a bit moved to the right.
As soon though as I set the scaling on Win10 to 100% it will appear as intended, in the center of the screen.
But again, as soon as a user has the Win10 default settings running (which is often >100%) it gets screwed up.
This is my code
Code: Select all
ExamineDesktops()
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @r.RECT, 0)
WW = r\right - r\left
WH = r\bottom - r\top
bs=OpenWindow(#PB_Any,0,0,DesktopWidth(0),DesktopHeight(0),"",#PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Screen_WaitSynchronization)
SetWindowColor(bs,0)
HideWindow (bs,#True)
CreateImage(0,WW,WH)
hDC = StartDrawing(ImageOutput(0))
BitBlt_(hDC,0,0,WW,WH,GetDC_(GetDesktopWindow_()), r\left,r\top, #SRCCOPY)
StopDrawing()
myBrush = CreatePatternBrush_(ImageID(0))
SetClassLongPtr_(WindowID(bs), #GCL_HBRBACKGROUND, myBrush)
InvalidateRect_(WindowID (bs),0,1)
FreeImage(0)
AnimateWindow_(WindowID (bs),700,#AW_CENTER|#AW_ACTIVATE)
// Moved from "Tricks 'n' Tips" (Kiffi)