Jump to content

Transparent Black Over Desktop Area


Recommended Posts

Trying to make a small app that makes my laptop screen darker as I'm watching TV at night. The built-in brightness controls doesn't make the screen dark enough.

One thought is a transparent box over the bottom left corner of my desktop in front of where I normally start my streaming TV app.

 

Thing is the regular transparency effect makes it lighter. See this example: Hoping there is a way to maybe put a black transparent mask over it or any other tricks that might do the job

 

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

$Form1 = GUICreate("Form1", 615, 437, 192, 124)
GUISetBkColor(0x000000)
$click = GUICtrlCreateButton("Click To Test Trans for 3 secs", 224, 80, 241, 121)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $click
            $pos = WinGetPos("Form1", "")
            GUICreate("", $pos[2], $pos[3], $pos[0], $pos[1], $WS_DISABLED)
            GUISetState(@SW_SHOW)
            WinSetTrans("", "", 200)
            Sleep(3000)
            GUIDelete(WinGetHandle("", ""))
    EndSwitch
WEnd

 

Link to post
Share on other sites

Try this if OK ?   Win close from taskbar

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

$ghost_gui = GUICreate("ghost_gui", 615, 437, 192, 124, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor("0x0D1117")     ; $COLOR
WinSetTrans($ghost_gui, "", 80)
GUISetState(@SW_SHOW, $ghost_gui)

; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

    EndSwitch
WEnd

 

Link to post
Share on other sites

Hi @NassauSky,

I extended the code change of @ioa747 just a bit more:

#include-once
#include <WindowsConstants.au3>

Global Const $iGuiCloseFlag = -3
Global Const $hGui = GUICreate('ghost_gui', 615, 437, 192, 124, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TRANSPARENT)

GUISetBkColor('0x0D1117')
WinSetTrans($hGui, '', 80)
GUISetState(@SW_SHOW, $hGui)

While True
    Switch GUIGetMsg()
        Case $iGuiCloseFlag
            ExitLoop
    EndSwitch
WEnd

Advantage:
You can click through the transparent GUI and control your windows behind it 😀 . Before adding $WS_EX_TRANSPARENT you couldn't do that.

Disadvantage:
If you want to close the transparent GUI and you have clicked somewhere, you have to get the focus back to your transparent GUI, by the taskbar or the TaskView button for example.

Best regards
Sven

________________
Stay innovative!

Stay innovative!

Spoiler

🌍 Au3Forums

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔍 Forum search

🔮 Me on GitHub

💬 Opinion about new forum sub category

 📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to post
Share on other sites

I know that I'm not helping with the script but I'm curious, why not just decrease the brightness of the screen?

Edit: I was stupid and didn't read this

8 hours ago, NassauSky said:

The built-in brightness controls doesn't make the screen dark enough.

  There might already be programs out there which can do this for you, perhaps they might be a better option.

 

Edited by TheDcoder

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...