Grab whole or part-screen in JB/LB

The above image of my computer screen ( cross-country ski tracks at dusk, winter 2009-2010) was captured by the JB program below, which runs a timed capture at regular intervals. It has however been converted to a jpg and scaled, for display purposes here. This can be done externally by a program like PSP, PhotoShop, IrfanView or the GIMP. It can be done programmatically via ImageMagick, or ( in LB) by calling a dll.

You stop this version by closing the little window or right-clicking on the icon on the taskbar at the bottom and choosing 'Close' or 'Kill Basic programs'. It's up to you where you place the program's window or how big you make it. Put it off-screen if you want; or do some graphics within a larger version and grab only that part... You can also change the timer interval, and where to save to. There is no need to call the routine via a timer- you may well just want to include the grab as part of a program, perhaps called when a button is clicked...

I most usually use a Ramdisk, or a known accessible folder like C:/Temp.



    WindowWidth  =  100
    WindowHeight =   40
    UpperLeftX   =    1
    UpperLeftY   =    1

    GrabInterval =10000 '   in ms.

    nomainwin

    open "LB" for graphics as #main

    #main, "trapclose [quit]"

    timer GrabInterval, [grabscreen]
    wait

[grabscreen]
    timer 0
    #main     "getbmp scr 0 0 1800 1000"
    bmpsave   "scr", "C:\Temp\window.bmp"
    unloadbmp "scr"
    timer GrabInterval, [grabscreen]
    wait

[quit]
    close #main
    END