Hi all. I am using the following code to copy an image of my 1920x1080 desktop and show it in a window over my real desktop, and it works great at 100% DPI:
Code: Select all
Global w,h
Procedure ScreenshotDesktop()
ExamineDesktops()
w=DesktopWidth(0)
h=DesktopHeight(0)
hImage=CreateImage(#PB_Any,w,h)
If hImage
hDC=StartDrawing(ImageOutput(hImage))
If hDC
dt=GetDesktopWindow_()
dc=GetDC_(dt)
If dc
If BitBlt_(hDC,0,0,w,h,dc,0,0,#SRCCOPY)
ssdesktop=hImage
EndIf
ReleaseDC_(dt,dc)
EndIf
StopDrawing()
EndIf
EndIf
ProcedureReturn ssdesktop
EndProcedure
ss=ScreenshotDesktop()
StartDrawing(ImageOutput(ss))
DrawText(5,5," This is the captured image ("+Str(ImageWidth(ss))+"x"+Str(ImageHeight(ss))+" / Esc to close) ",#Yellow)
StopDrawing()
OpenWindow(0,0,0,w,h,"",#PB_Window_BorderLess)
ImageGadget(0,0,0,w,h,ImageID(ss))
Repeat : WaitWindowEvent() : Until GetAsyncKeyState_(#VK_ESCAPE)

See how the desktop's Start button, taskbar, and system tray items (clock, etc) aren't visible? I know I can turn on DPI-awareness to fix this, but let's pretend that I can't for any given reason. Is there a way to make this image scale properly and not be cropped when DPI awareness is off? As I said, the image is the correct desktop size, but just isn't showing all of itself.
