A CaptureDesktop function, which uses the CaptureScreenArea function.
;Capture Desktop function, by markcw on 16 Jul 06 Graphics3D 320,240,0,2 SetBuffer BackBuffer() initime=MilliSecs() While Not KeyHit(1) If done=0 And MilliSecs()>initime+50 ;wait for text info done=1 : CaptureDesktop() EndIf Cls Text 0,0,"OK, paste the current clipboard data" Text 0,12,"to whatever program you use to see" Text 0,24,"the results of the screen capture." Text 0,36,"done="+done+" initime="+initime Flip Wend Function CaptureDesktop() ;Capture the entire desktop area to the clipboard ;From PureBasic Forum source, by Droopy on 18/10/2005 Local dwidth,dheight dwidth=Api_GetSystemMetrics(0) ;SM_CXScreen dheight=Api_GetSystemMetrics(1) ;SM_CYScreen CaptureScreenArea(0,0,dwidth,dheight) ;x,y,width,height End Function Function CaptureScreenArea(sx,sy,swidth,sheight) ;Capture a given screen area to the clipboard ;From PureBasic CodeArchiv source, by wayne1 on 30/1/2002 Local hdcSrc,hdcDst,hbmp,hold hdcSrc=Api_GetDC(0) ;hwnd hdcDst=Api_CreateCompatibleDC(hdcSrc) ;hdc hbmp=Api_CreateCompatibleBitmap(hdcSrc,swidth,sheight) ;hdc,width,height hold=Api_SelectObject(hdcDst,hbmp) ;hdc,hobject[bitmap] Api_BitBlt(hdcDst,0,0,swidth,sheight,hdcSrc,sx,sy,$00CC0020) ;SrcCopy Api_SelectObject(hdcDst,hold) ;restore old to dc If Api_OpenClipboard(0) ;hwnd Api_EmptyClipboard() ;free last data Api_SetClipboardData(2,hbmp) ;CF_Bitmap,hdata[bitmap] Api_CloseClipboard() EndIf Api_ReleaseDC(0,hdcSrc) ;hwnd,hdc Api_DeleteDC(hdcDst) ;hdc End Function