Code: Select all
GrabDesktop(#Desktop, x,y ,width,height)
Code: Select all
GrabDesktop(#Desktop, x,y ,width,height)
+1eddy wrote:just an idea
Code: Select all
GrabDesktop(#Desktop, x,y ,width,height)
+1#NULL wrote:just in case it will be implemented: please make each parameters for the dimension optional to grab the hole area, or allow -1 or such.
Code: Select all
Procedure GrabDesktop(PosX,PosY,Width,Height)
Protected Result,Depth,MyImage,hc,GetDC
Result=ExamineDesktops() ; How Many desktops
If Result
If PosX=-1:posX=0:EndIf
If PosY=-1:PosY=0:EndIf
If Width=-1:Width=DesktopWidth(0):EndIf
If Height=-1:Height=DesktopHeight(0):EndIf
Depth=DesktopDepth(0) ; Desktop color Depth in bpp
If Depth>0
MyImage=CreateImage(#PB_Any,Width,Height,Depth)
hc=StartDrawing(ImageOutput(MyImage))
If hc
GetDC=GetDC_(GetDesktopWindow_())
BitBlt_(hc,0,0,Width,Height,GetDC,PosX,PosY,#SRCCOPY)
StopDrawing()
ReleaseDC_(GetDesktopWindow_(),GetDC)
EndIf
EndIf
EndIf
ProcedureReturn ImageID(MyImage)
EndProcedure
Code: Select all
startX=150
StartY=200
w=300
h=450
spr=CreateSprite(0,w,h)
Img=GrabDesktop(StartX,StartY,w,h)
StartDrawing(SpriteOutput(0))
DrawImage(Img,0,0,w,h)
StopDrawing()
right Matt, but you know, i'm a PB beginner, i do my best to help other beginners.Matt wrote:Yes, but for all platforms. And straight integration into PureBasic would be nice.
better yet, #PB_Ignore#NULL wrote:just in case it will be implemented: please make each parameters for the dimension optional to grab the hole area, or allow -1 or such.