x taol said:
i want to disable the maximizebox of top,right of Excel application
title bar.
how can i?
*** Sent via Developersdex
http://www.developersdex.com ***
Use the windows API:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As
Long
Public Sub DisableMaximizeButton()
Dim hWnd As Long
Dim hWndStyle As Long
hWnd = FindWindow("XLMAIN", Application.Caption)
hWndStyle = GetWindowLong(hWnd, -16)
hWndStyle = hWndStyle And Not &H10000
SetWindowLong hWnd, -16, hWndStyle
End Sub