disable maximizebox in Excel Title bar

M

moon

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
 
X

x taol

Thank you very much moon.... but the big problem occured.
After the excel minimize, do the excel up again. and then the excel
enter down windows taskbar.

oooooo. please....



*** Sent via Developersdex http://www.developersdex.com ***
 
X

x taol

Thank you very much moon.... but the big problem occured.
After the excel minimize, do the excel up again. and then the excel
enter down windows taskbar.

oooooo. please....



*** Sent via Developersdex http://www.developersdex.com ***
 
M

moon

x taol said:
Thank you very much moon.... but the big problem occured.
After the excel minimize, do the excel up again. and then the excel
enter down windows taskbar.

oooooo. please....



*** Sent via Developersdex http://www.developersdex.com ***


I don't have that problem here, here it works just fine. But you can switch
back to normal, using:

hWndStyle = hWndStyle Or &H10000


The only thing is that I first have to move my mouse over the titlebar
before the MaximizeBox appears or disappears, even after a setfocus.
 
X

x taol

no good. it doesn't work.
i want to work well.
my wanting is that the maximizebox disable and minimize and restore(up)
again and then the excel window be to appear normaly.
abnormaly, after minimize the excel window, the window enter down
windows taskbar, like full screen.

*** Sent via Developersdex http://www.developersdex.com ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top