Ticket #4078: Nouveau AutoIt v3 Script.au3

File Nouveau AutoIt v3 Script.au3, 2.0 KB (added by TommyDDR, on Mar 11, 2026 at 3:47:02 PM)
Line 
1#include <Color.au3>
2#include <GUIConstantsEx.au3>
3#include <StaticConstants.au3>
4#include <StructureConstants.au3>
5#include <WinAPIGdi.au3>
6
7Opt("MustDeclareVars", 1)
8Opt("GUIOnEventMode", 1)
9
10Global $hWnd
11Global $btnCorner
12Global $lblCorner
13Global $border = 5
14Global $buttonSize = [100, 25]
15Global $size[2] = [2*$border + $buttonSize[0], 3*$border + 2*$buttonSize[1]]
16
17Global $cornerChanged = False
18
19$hWnd = GUICreate("", $size[0], $size[1])
20GUISetOnEvent($GUI_EVENT_CLOSE, quit)
21$lblCorner = GUICtrlCreateLabel("", $border, $border, $buttonSize[0], $buttonSize[1], BitOR($SS_CENTER, $SS_CENTERIMAGE))
22$btnCorner = GUICtrlCreateButton("Change corner", $border, 2*$border + $buttonSize[1], $buttonSize[0], $buttonSize[1])
23GUICtrlSetOnEvent($btnCorner, changeCorner)
24GUISetState()
25
26updateValue()
27
28While 1
29 Sleep(25)
30WEnd
31
32Func updateValue()
33 Local $corner = __WinAPI_DwmGetWindowAttribute($hWnd, 33)
34 GUICtrlSetData($lblCorner, @error ? "READING ERR" : $corner)
35EndFunc
36
37Func changeCorner()
38 Local $newCorner = Mod(__WinAPI_DwmGetWindowAttribute($hWnd, 33)+1, 5)
39 _WinAPI_DwmSetWindowAttribute($hWnd, 33, $newCorner)
40 updateValue()
41EndFunc
42
43Func __WinAPI_DwmGetWindowAttribute($hWnd, $iAttribute)
44 Local $tagStruct
45 Switch $iAttribute
46 Case 33
47 $tagStruct = 'dword'
48 Case 5, 9
49 $tagStruct = $tagRECT
50 Case 1, 14
51 $tagStruct = 'uint'
52 Case Else
53 Return SetError(1, 0, 0)
54 EndSwitch
55
56 Local $tData = DllStructCreate($tagStruct)
57 Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmGetWindowAttribute', 'hwnd', $hWnd, 'dword', $iAttribute, _
58 'struct*', $tData, 'dword', DllStructGetSize($tData))
59 If @error Then Return SetError(@error + 10, @extended, 0)
60 If $aCall[0] Then
61 ConsoleWrite(_WinAPI_GetLastError() & " (" & $iAttribute & ") : " & _WinAPI_GetLastErrorMessage() & @CRLF)
62 Return SetError(10, $aCall[0], 0)
63 EndIf
64
65 Switch $iAttribute
66 Case 1, 14, 33
67 Return DllStructGetData($tData, 1)
68 Case Else
69 Return $tData
70 EndSwitch
71EndFunc ;==>_WinAPI_DwmGetWindowAttribute
72
73Func quit()
74 Exit
75EndFunc