Jump to content

Click through gui

Recommended Posts


I have two GUIs, my main GUI and a clock GUI which has a transparent background so all you see is the actual time. My main sits behind the clock. On my main, right behind the clock, there is a region where if I click in it a function activates. The problem is I can't click on top of the numbers being displayed by the clock, I'm only able to click around the numbers in the transparent area of the clock. Is there a way to make it possible to click the main GUI through the numbers being displayed on the clock like I'm able to click through the other parts of the clock that's transparent?

Share this post

Link to post
Share on other sites

A solution could be : catch the mouse cursor position when clicking and then click the main gui at the same location

Share this post

Link to post
Share on other sites

Use the $WS_EX_TRANSPARENT style for your clock to click through.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
Share on other sites

Click through a hole in the GUI in this example.

#include <WinAPI.au3>
#include <WindowsConstants.au3>

; Modified from http://www.autoitscript.com/forum/index.php?showtopic=12476&view=findpost&p=784783
; Also see:-  AutoIt Help file > _WinAPI_CreateRoundRectRgn Function > Example

Local $hGui = GUICreate("", 500, 500, -1, -1, -1, $WS_EX_TOPMOST)

_GuiHole($hGui, 50, 50, 100, 100)
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop

Func _GuiHole($hWin, $iX, $iY, $iW, $iH)
    Local $pos, $outer_rgn, $inner_rgn, $combined_rgn
    $pos = WinGetPos($hWin)
    $outer_rgn    = _WinAPI_CreateRectRgn(0, 0, $pos[2], $pos[3])
    $inner_rgn    = _WinAPI_CreateRectRgn($iX, $iY, $iX + $iW, $iY + $iH)
    $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
    _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF) ; $RGN_DIFF constant in WindowsConstants.au3
    _WinAPI_SetWindowRgn($hWin, $combined_rgn)
EndFunc   ;==>_GuiHole


Share this post

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.