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 comment
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

 

I know that I know nothing

Link to comment
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 (en) Cheat Sheet

📊 AutoIt limits/defaults

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

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
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 comment
Share on other sites

  • 1 month later...

..I use a dark theme called BIB3 ;)
Works in Win10 and 11 quite well.

Here's a small snapshot:
image.png.21930438b2b14f7cf73ec5532c85cc5b.png

Am also requesting a Dark mode help file at https://www.autoitscript.com/forum/topic/209770-cssdefaultcss-in-helpfile/
I hope it takes off and we have a less painful experience in the Windows canvas 😇 

 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

no, none imposed by this site that I know. I just had it for the longest time and deviantart changed a lot as a site.
Then again by now there may be a better version, or your search leads you to something different.

<Rant> these ppl at deviantart they now have this "watchers only" that Ggrrr...</rant>

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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...