| 1 | #include <Color.au3>
|
|---|
| 2 | #include <GUIConstantsEx.au3>
|
|---|
| 3 | #include <StaticConstants.au3>
|
|---|
| 4 | #include <StructureConstants.au3>
|
|---|
| 5 | #include <WinAPIGdi.au3>
|
|---|
| 6 |
|
|---|
| 7 | Opt("MustDeclareVars", 1)
|
|---|
| 8 | Opt("GUIOnEventMode", 1)
|
|---|
| 9 |
|
|---|
| 10 | Global $hWnd
|
|---|
| 11 | Global $btnCorner
|
|---|
| 12 | Global $lblCorner
|
|---|
| 13 | Global $border = 5
|
|---|
| 14 | Global $buttonSize = [100, 25]
|
|---|
| 15 | Global $size[2] = [2*$border + $buttonSize[0], 3*$border + 2*$buttonSize[1]]
|
|---|
| 16 |
|
|---|
| 17 | Global $cornerChanged = False
|
|---|
| 18 |
|
|---|
| 19 | $hWnd = GUICreate("", $size[0], $size[1])
|
|---|
| 20 | GUISetOnEvent($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])
|
|---|
| 23 | GUICtrlSetOnEvent($btnCorner, changeCorner)
|
|---|
| 24 | GUISetState()
|
|---|
| 25 |
|
|---|
| 26 | updateValue()
|
|---|
| 27 |
|
|---|
| 28 | While 1
|
|---|
| 29 | Sleep(25)
|
|---|
| 30 | WEnd
|
|---|
| 31 |
|
|---|
| 32 | Func updateValue()
|
|---|
| 33 | Local $corner = __WinAPI_DwmGetWindowAttribute($hWnd, 33)
|
|---|
| 34 | GUICtrlSetData($lblCorner, @error ? "READING ERR" : $corner)
|
|---|
| 35 | EndFunc
|
|---|
| 36 |
|
|---|
| 37 | Func changeCorner()
|
|---|
| 38 | Local $newCorner = Mod(__WinAPI_DwmGetWindowAttribute($hWnd, 33)+1, 5)
|
|---|
| 39 | _WinAPI_DwmSetWindowAttribute($hWnd, 33, $newCorner)
|
|---|
| 40 | updateValue()
|
|---|
| 41 | EndFunc
|
|---|
| 42 |
|
|---|
| 43 | Func __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
|
|---|
| 71 | EndFunc ;==>_WinAPI_DwmGetWindowAttribute
|
|---|
| 72 |
|
|---|
| 73 | Func quit()
|
|---|
| 74 | Exit
|
|---|
| 75 | EndFunc
|
|---|