Jump to content

geon79

Members
  • Posts

    4
  • Joined

  • Last visited

geon79's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Ok, I don't know exactly why, with a few changes it actually works without using WinAPI, all it needs is the extended style $WS_EX_TRANSPARENT in the GUI creation. Why didn't it work in previous versions? I haven't got he slightest clue. Now it's usable, thanks a lot Surya for help. The only final improvement that would make it perfect is having totally transparent background (for Graphic controls mainly), I can set only overall transparency at the moment, $GUI_BKCOLOR_TRANSPARENT seems to be ignored even for labels (while other colours can be set). #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $trans = 200 HotKeySet("{ESC}","esc") Global $hgui = GUICreate("Click-through topmost GUI", 250, 250,350, 350,$WS_POPUP,$WS_EX_TRANSPARENT) GuiCtrlCreateLabel("Label",60,60) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateGraphic(0,0,21,21) GUICtrlSetGraphic(-1,$GUI_GR_COLOR,0xff0000) GUICtrlSetGraphic(-1,$GUI_GR_PIXEL,10,10) GUICtrlSetGraphic(-1,$GUI_GR_COLOR,0x33ff22) GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE,0,0,21,21) WinSetOnTop($hgui, "", 1) WinSetTrans($hgui,"",$trans) GUISetControlsVisible($hgui) GUISetState() While 1 Sleep(100) WEnd Func GUISetControlsVisible($hWnd) ;thanks to the author of the function Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func esc() ;ESC to quit Exit EndFunc
  2. Now the label shows, but still I can't click through it. I couldn't anticipate this would be so much trouble to implement!
  3. It doesn't work A GUI will show at all only if GUISetState(@SW_SHOW) is called before GUISetControlsVisible function is called and the extended style "layered" is removed, but even then the result is wrong graphically (shows the top left part of the GUI window, not the control) and it isn't transparent. Setting the style to $WS_POPUP does show the control correctly but I can't click through it, probably because the GUI lacks the "layered" attribute. My programming skills aren't enough to understand how it's supposed to work. Any idea? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}","esc") Global $hGui = GUICreate("Click-through topmost GUI", 100, 100,200, 200, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TRANSPARENT, $WS_EX_LAYERED)) GuiCtrlCreateLabel("Label",-1,-1) GUISetState(@SW_SHOW) GUISetControlsVisible($hGui) While 1 Sleep(100) WEnd Func GUISetControlsVisible($hWnd) ;thanks to the author of the function Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func esc() ;ESC to quit Exit EndFunc
  4. I have a nagging problem I can't seem to find the solution of. What I'd like to create are graphic objects that overlay with specific areas of the screen and are completely "inconsistent" in the sense that any click will pass right through to the underlying window. My purpose is to highlight precisely specific areas that a user should click with bright colours: these areas are very irregular so they will be typically be drawn on a pixel-by-pixel basis. The rest of the window must be completely visible, so total transparency of the background of the hosting GUI is mandatory and the coloured areas must not block the clicking of what's under them, of course. Any idea of how it could be done? Thanks all in advance for help.
×
×
  • Create New...