Hi,
I remember seeing some code (using api) to grab the desktop, does anyone have it?
I remember seeing some code (using api) to grab the desktop, does anyone have it?
Graphics3D 800,600,16,1 Global dt quit = False While quit = False dt = GetDesktop(1) DrawImage dt, 0,0 If KeyHit(1) quit = True EndIf Wend Function GetDesktop(flag=0,update=0) ; ADAmor ZILTCH 2003 ; ; This command must come after your GRAPHICS(3D) x,y command. ; ; flag 0 = create texture ; 1 = create image ; ; if update is not 0 then it is the tex/image to update. DeskHwnd = GetDesktopWindow() ; Get screen coordinates fwidth = GetSystemMetrics%(0) ;RectWin\rightR - RectWin\leftR fheight = GetSystemMetrics%(1) ;RectWin\bottomR - RectWin\topR BlitzHwnd = GetActiveWindow() ShowWindow(BlitzHwnd,SW_HIDE) ; Get the device context of Desktop and allocate memory hdc = GetDC(DeskHwnd) Blitzhdc = GetDC(BlitzHwnd) ; Copy data BitBlt(Blitzhdc, 0, 0, fwidth, fheight, hdc, 0,0, SRCCOPY) ; Clean up handles ReleaseDC(DeskHwnd, hdc) ReleaseDC(BlitzHwnd, Blitzhdc) ShowWindow(BlitzHwnd,SW_SHOW) ; Create/update texture or image Select flag Case 0 If update = 0 Then tex=CreateTexture(fwidth,fheight) Else tex=update End If CopyRect 0,0,fwidth,fheight,0,0,FrontBuffer(),TextureBuffer(tex) Return tex Case 1 If update = 0 Then image=CreateImage(fwidth,fheight) Else image=update End If CopyRect 0,0,fwidth,fheight,0,0,FrontBuffer(),ImageBuffer(image) Return image End Select End Function