Jump to content

Click through gui


Champak
 Share

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?

Link to comment
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)
GUISetBkColor(0x008080)

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


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

 

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