Author Topic: Capturing the Current Screen Display  (Read 2908 times)

0 Members and 1 Guest are viewing this topic.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Capturing the Current Screen Display
« on: December 29, 2018, 07:03:12 am »
_SCREENIMAGE is a tool for capturing the currect Desktop display, and can therefore be used to capture the current program window display as we also know the top left and bottom right window positions.

Code: QB64: [Select]
  1. I& = _SCREENIMAGE(_SCREENX + XBorder%%, _SCREENY + YBorder%%, _SCREENX + _WIDTH + XBorder%%, _SCREENY + _HEIGHT + YBorder%%)

should return an image of the running program's screen image.

_SCREENX/Y return the program window's upper left corner horizontal/vertical positions on the desktop

_WIDTH/HEIGHT return the width/height of the present SCREEN

XBorder%%/YBorder%% are constant offsets to account for the widths of the window borders to the left and at the top.


I experimented with values of XBorder%% & YBorder%% to get the image I& exactly that of the program's window image, and I found that the values required to capture the exact full window did not equate to the widths of the window borders (close-ish, but not exact).

Is there a way to capture the exact image in the running program's window without having to use the above which requires manually adjusting the values of XBorder%% & YBorder%%? I imagine that, in any case, the window borders are set by the operating system.  I have been through the Wiki, and do not see a "capture the image inside the present window" function.

FellippeHeitor

  • Guest
Re: Capturing the Current Screen Display
« Reply #1 on: December 29, 2018, 08:14:23 am »
C& = _COPYIMAGE(_DISPLAY)

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Capturing the Current Screen Display
« Reply #2 on: December 29, 2018, 09:39:55 am »
Fellippe, thanks.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Capturing the Current Screen Display
« Reply #3 on: December 30, 2018, 12:09:16 pm »
I could not work out why this method worked with a trial program, but would display the captured screen image as blank in my project program.  In my project program, the images are _HARDWARE, and then the _COPYIMAGE doesn't work, even if you try _COPYIMAGE(_DISPLAY,32), trying to force it to create a software temporary image.  Another part of image display methods about which I understand nothing.  I will revert to my pre-existing 'cheat' method for temporarily capturing the screen image.