找到了ˊ方法并修改#include <WindowsConstants.au3>
#include <Winapi.au3>
Run("notepad.exe")
WinWait("[CLASS:Notepad]", "", 10)
_WinResizingDis()
MsgBox(0, 0, 'Dis', 5)
Sleep(2000)
_WinResizingEnb()
MsgBox(0, 0, 'Enb', 5)
Func _WinResizingDis() ;;让缩放无效化
_WinResizingMain('Dis')
EndFunc
Func _WinResizingEnb() ;;让缩放有效化
_WinResizingMain('Enb')
EndFunc
Func _WinResizingMain($val)
Local $list, $shwnd, $style, $winClass
If $val = 'Enb' Then
$winClass = "[CLASS:Notepad]"
$list = WinList($winClass)
For $i = 1 to $list[0][0]
$shwnd = $list[$i][1]
$style = _WinAPI_GetWindowLong($shwnd, $GWL_STYLE)
If BitAnd($style, BitOr($WS_SIZEBOX, $WS_MAXIMIZEBOX)) Then
;;
Else
_WinAPI_SetWindowLong($shwnd, $GWL_STYLE, BitXOR($style, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
EndIf
Sleep(50)
Next
EndIf
If $val = 'Dis' Then
$winClass = "[CLASS:Notepad]"
$list = WinList($winClass)
For $i = 1 to $list[0][0]
$shwnd = $list[$i][1]
$style = _WinAPI_GetWindowLong($shwnd, $GWL_STYLE)
If BitAnd($style, BitOr($WS_SIZEBOX, $WS_MAXIMIZEBOX)) Then
_WinAPI_SetWindowLong($shwnd, $GWL_STYLE, BitXOR($style, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
EndIf
Sleep(50)
Next
EndIf
EndFunc
|