ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable maximizebox in Excel Title bar (https://www.excelbanter.com/excel-programming/374545-disable-maximizebox-excel-title-bar.html)

x taol

disable maximizebox in Excel Title bar
 


i want to disable the maximizebox of top,right of Excel application
title bar.

how can i?

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

moon[_7_]

disable maximizebox in Excel Title bar
 

"x taol" schreef in bericht
...


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 taol

disable maximizebox in Excel Title bar
 
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 taol

disable maximizebox in Excel Title bar
 
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 ***

moon[_7_]

disable maximizebox in Excel Title bar
 

"x taol" schreef in bericht
...
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 taol

disable maximizebox in Excel Title bar
 


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 ***


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com