Jump to content

Screensaver transparent


jcpetu
 Share

Recommended Posts

Hi community,

I was trying to do a transparent screen saver to allow viewing survillance cameras in real time while the desktop is password protected.

My screen saver is activated but the desktop background hides the desktop and not allows to see the cameras.

Is it any way to hide desktop background.

Thanks a lot and regards.

#include <GUIConstantsEx.au3>
#include <windowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $user32 = DllOpen('user32.dll')
GUICreate("Screensaver", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
WinSetTrans("Screensaver", "", 30) ;semitransparent for testing pourposes
GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "Quit") ; exit program on mouse move
HotKeySet("{ESC}", "Quit") ; exit program on ESC
GUISetCursor(16, 1) ; hide mouse cursor
;UISetBkColor (0x000000) ; set screen backround
GUISetState()
Do
If _IsAnyKeyPressed() Then Exit
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Exit
Func Quit() ; exit program
    Exit
EndFunc
Func _IsAnyKeyPressed($vDLL = 'user32.dll')
If __KeyPressCheck(1, 221, -1, $vDLL) Then Return 1
Return 0
EndFunc   ;==>_IsAnyKeyPressed
Func __KeyPressCheck($iStart, $iFinish, $iHexKey = -1, $vDLL = 'user32.dll')
Local $ikey, $ia_R
For $ikey = $iStart To $iFinish
  If $iHexKey == -1 Then $ia_R = DllCall($vDLL, 'int', 'GetAsyncKeyState', 'int', '0x' & Hex($ikey, 2))
  If $iHexKey <> -1 Then $ia_R = DllCall($vDLL, 'int', 'GetAsyncKeyState', 'int', '0x' & $iHexKey)
  If Not @error And BitAND($ia_R[0], 0x8000) = 0x8000 Then Return 1
Next
Return 0
EndFunc   ;==>__KeyPressCheck
Link to comment
Share on other sites

The problem is not that background hides the desktop but Windows switches desktops when it lauches a screensaver. What you are seeing is not your desktop but Window's "secure" desktop.

The only time I have seen a program do what you are asking is with a program called Transparent Screen Lock. http://www.e-motional.com/TScreenLock.htm

Part of that package is a screensaver module called Transparent Screen Lock.scr For some reason they allow you to see your live desktop. You may want to look at it to get some ideas.

Let me know what you find

Link to comment
Share on other sites

  • 2 years later...

Perhaps this will do the job.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hBarGUI = GUICreate("", @DesktopWidth, @DesktopHeight + 200, -1, -1, 0x80000000, $WS_EX_TOPMOST)
$User = GUICtrlCreateInput("", 25,75, 75, 25)
$Pass = GUICtrlCreateInput("", 25,125, 75, 25)
GUISetBkColor(0xFF, $hBarGUI)
WinSetTrans($hBarGUI, '', 0)
WinSetState($hBarGUI, '', @SW_SHOW)
WinMove($hBarGUI, '', 0, -19)
WinSetTrans($hBarGUI, '', 50)
$Unlock = GUICtrlCreateButton("Unlock", 25, 175, 75, 25)
GUISetState()
$rUser = "test"
$rPass = "test"

While 1
    $hMsg = GUIGetMsg()
    Switch $hMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Unlock
            $fUser = GUICtrlRead($User)
            $fPass = GUICtrlRead($Pass)
            If $fUser = $rUser And $fPass = $rPass Then
                ConsoleWrite('done')
                Exit
            Else
                ToolTip('Invalid User/pass',0,0)
            EndIf
    EndSwitch
    Sleep(100)
WEnd

Might be messy, but its working for me.

 

EDIT: Noticed that it doesn't fully cover the screen at the bottom, increased the length and changed the button and input fields location for better viewing.

Edited by Palestinian
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...