QB64.org Forum
Active Forums => Programs => Topic started by: Petr on September 10, 2018, 03:39:18 pm
-
Hi. I wrote a very primitive screen scanner. To try out the program, first place it somewhere to the corner in the screen, then leave the video from Youtube on the rest of the monitor. Compile and run the program. A still image is taken. Use the mouse to select the crop to be recorded (left button, press hold, drag and drop) and confirm with the space bar. The program is minimized and begins recording the selected area into memory. To hang up and play, click the icon in the task bar to get a black window where it says how many frames are already being uploaded (to RAM). Press enter to stop recording. Press any key to play.
This is a function. The question is this: How do I capture the current screen so it does not overlap with the program window? What is the opposite function to _SCREENICON? Can the surface be scanned otherwise? This program attacked me today ... thanks for the suggestions.
LOCATE 1, 1:
PRINT "Select on screen area with mose for recording, then press SPACEBAR for start and ENTER for end recording." IF mx
<> 0 THEN mx
= 0: ox
= 0
' old = _DEST
start = 1
i$ = ""
i = i + 1
LOCATE 1, 1:
PRINT "recording..."; i;
"frames " 'HOW do it visible, if is program minimalized? start = 0
created = 1
PRINT "Press key for play content:"
created = 0
-
http://qb64.org/wiki/SCREENSHOW -- _SCREENSHOW is opposite of _SCREENHIDE
-
Thanks Steve, but this is not opposite for SCREENICON (i tryed it and program wont not maximalized)
-
Thanks Steve, but this is not opposite for SCREENICON (i tryed it and program wont not maximalized)
Maybe $SCREENSHOW? If not, I'm stumped
-
No, after _SCREENICON it is minimalized for ever...
-
Use _SCREENHIDE instead of _SCREENICON then, so you'll be able to _SCREENSHOW it again.
If you want to do it programmatically, that's your alternative for now. If you minimize the Window, you'll have to wait for your user to want to click it again in the taskbar.
Or likely use a call to a Windows API to restore the window. Technically, a minimized window is one that's relocated to position (-32000, -32000).
-
I'm working on it. Thanks for the help.
-
Also: Every time you call _SCREENIMAGE, you'll be creating a new handle and consequently allocating new memory for the new screenshot. Don't forget to _FREEIMAGE it after using it, or your program will quickly crash with an 'out of memory' error.
-
Yeah, I think to it. I need to know how to stop scanning because after the SCREENHIDE command I have to click on the monitor to restore the image of the web player and thus lose control over the program - it does not respond to the keyboard and runs in the background. That's what I found BUT I put a certain amount of time to stop him. Without it... how drive it after call SCREENHIDE?
-
In my experience the window remained focused and responsive even after using _SCREENHIDE:
If you run the code above and hit a key, the window will hide. Do nothing for 3 seconds and it will show again.
BUT!
If you hit a key to hide it, then hit any key while it's SLEEPing, the sleep timer will be interrupted and the window will show up again immediatelly.
Please confirm that also works on your machine.
-
Yes, it works. But i have this case. Use this code, run it, after first pressing click with mouse to other program. Then you never end it, you lose control.
-
Clicking another program will surely take focus from your program and it's hidden, of course you'll lose control of it.
If you must hide a program, make sure it'll come back programmatically later. Set a timer or something.
-
How about you just move it away then move it back on (all timer based too)?
'do your thing
'sleep some