Main Menu

Desktop and PlayBasic code question

Started by DataSmith, March 24, 2014, 09:31:26 PM

Previous topic - Next topic

DataSmith

Hello; I am looking to solve two code problems I have encountered ...

(the smaller the code the better)
#1. How can you grab the current DeskTop as a image and display it on the screen?
#2. How can you NOT show the screen until you are ready to on program start up?

This is a bit of what I have at the moment ...
I'm using a 2 line code with AutoIt3 to get a .jpg file to the TempDir$ ...
------------
#include <ScreenCapture.au3>
_ScreenCapture_Capture(@TempDir &"\Snap.jpg")
-----------
This code creates a Snap.jpg of the DeskTop perfectly (like to have is done by Play Basic)
Then I run my PlayBasic code from this script and exit AutoIt3.

The PlayBasic code:
-----------
LoadImage TempDir$()+"snap.jpg",1
OpenScreen GetImageWidth(1)-1,GetImageHeight(1)-1,GetImageDepth(1),2
LoadImage TempDir$()+"snap.jpg",1
-----------

This all works fine but,
#1. I want to do the screen grab using only PlayBasic.
#2. I want to bring the PlayBasic screen to front when it is ready to go
with out any type of black blank screen ...

From DeskTop to screen should be unnoticeable in every way.

Working on some nice effects played out as if they were on the DeskTop as a screen blanker type of program.
The black screen is just a killer. Was hoping to get this to transition way smoother. I can't find any type of
Screen Hide or Screen Show code and the Hide mode for the menu [projects> settings> screen> mode > hide] is not implemented at all.
Nor is the 0 = No Display (not presently supported) from the Screen Open command.
:'(

Any help with ether of these code segments would be sweet.


kevin


  This seems to hide/show the window..  can't imagine it being transparent as start up though.
   
PlayBASIC Code: [Select]
   Constant HWND_TOPMOST = -1
Constant SWP_NOMOVE = 2
Constant SWP_NOSIZE = 1

Constant SWP_SHOWWINDOW = 0x0040
Constant SWP_HIDEWINDOW = 0x0080

linkdll "user32.dll"
SetWindowPos(hwnd,hWndInsertAfter,x,y,cx,cy,wFlags) alias "SetWindowPos" As integer
Endlinkdll



Function HideScreen()
hwnd=GetScreenHandle()
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_HIDEWINDOW or SWP_NOMOVE Or SWP_NOSIZE)
EndFunction


Function ShowScreen()
hwnd=GetScreenHandle()
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW or SWP_NOMOVE Or SWP_NOSIZE)
EndFunction


print "hello world"

sync
wait 1000

HideScreen()

wait 1000

showscreen()
print "Back Again"

sync
waitkey





See-> SetWindowPos on MSDN