QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _CLIPBOARDIMAGE (function) function pastes an image from the clipboard into a new 32-bit image in memory.

Syntax

newImageHandle& = _CLIPBOARDIMAGE (function)

Description

Availability

Example(s)

Monitoring the clipboard for new images copied from other programs:


SCREEN _NEWIMAGE(800, 600, 32)
DO
    CLS
    COLOR _RGB32(177, 177, 177)
    PRINT "Monitoring clipboard..."
    IF img& < -1 THEN _FREEIMAGE img&
    img& = _CLIPBOARDIMAGE
    IF img& < -1 THEN
        PRINT "Image found:"
        COLOR _RGB32(255, 255, 255)
        PRINT "Width :"; _WIDTH(img&)
        PRINT "Height:"; _HEIGHT(img&)
        w = _WIDTH / 2 - _WIDTH(img&) / 2
        IF w < 0 THEN w = 0
        _PUTIMAGE (w, CSRLIN * _FONTHEIGHT), img&
    ELSE
        PRINT "No image found."
    END IF
    _DISPLAY
    _LIMIT 10
LOOP

See Also