Public Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Sub Prevent_Window_Resize()
Dim hWnd As Long
Dim style As Long
Dim ret As Long
hWnd = Application.hWnd
style = GetWindowLong(hWnd, GWL_STYLE)
style = style And Not (WS_THICKFRAME Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX)
ret = SetWindowLong(hWnd, GWL_STYLE, style)
End Sub
複製代碼
要還原可把
style = style And Not (WS_THICKFRAME Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX)
改成
style = style OR (WS_THICKFRAME Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX)
再執行