From QB64 Wiki

Jump to: navigation, search

The _SCREENIMAGE function stores the current desktop image or a portion of it and returns a handle value to reference.


handle& = _SCREENIMAGE[(column1, row1, column2, row2)]


  • The handle& value is the desktop image reference in memory of the present user's desktop.
  • The optional screen column and row positions can be used to get only a portion of the desktop image.
  • The desktop image or partial image is always a 32-bit image.
  • The current screen resolution or width-to-height aspect ratio can be measured using the handle with _WIDTH and _HEIGHT.
  • Can be used to take screen shots of the desktop or used with _PRINTIMAGE to print them.
  • It is IMPORTANT to free unused or uneeded image handles with _FREEIMAGE to prevent memory overflow errors!
  • Keyword Not Supported in Linux or MAC versions

Example: Determining the present screen resolution of user's PC for a screensaver program.

desktop& = _SCREENIMAGE MaxScreenX& = _WIDTH(desktop&) MaxScreenY& = _HEIGHT(desktop&) _FREEIMAGE desktop& 'free image after measuring screen(it is not displayed) SCREEN _NEWIMAGE(MaxScreenX&, MaxScreenY&, 256) 'program window is sized to fit _SCREENMOVE _MIDDLE

Screen image savers:

  • SAVEIMAGE (QB64 Image to Bitmap SUB by Galleon)
  • Program ScreenShots (Member program for legacy screen modes)
  • ThirtyTwoBit SUB (QB64 Image area to bitmap)

See also:

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Personal tools