Hello,
Does anyone know if it is possible to disable the Internet Explorer's maximize button and how to do it? Please help.....
Thanks.
______________________________________
vbBoy.
Printable View
Hello,
Does anyone know if it is possible to disable the Internet Explorer's maximize button and how to do it? Please help.....
Thanks.
______________________________________
vbBoy.
uses form with a command button called cmdKillIE
Code:Option Explicit
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) 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
Private Const GWL_STYLE = (-16)
Private Const MF_BYCOMMAND = &H0&
Private Const SC_MINIMIZE = &HF020
Private Const WS_MINIMIZEBOX = &H20000
Private Const SC_MAXIMIZE = &HF030&
Private Const WS_MAXIMIZEBOX = &H10000
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub cmdKillIE_Click()
Dim lhWnd&
Dim hMenu As Long, k As Long
lhWnd = FindWindowEx(0&, 0&, "IEFrame", vbNullString)
hMenu = GetSystemMenu(lhWnd, False)
k = DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
k = GetWindowLong(lhWnd, GWL_STYLE)
k = k Xor WS_MAXIMIZEBOX
SetWindowLong lhWnd, GWL_STYLE, k
End Sub
It did help.
_______________________________________________
vbBoy.
hi crispin
It did work... but if i try it once again it gets back the maximize button..
but on clicking the maximize button my IE doesnt get maximized...
maximize button becomes useless..
could you please check it..
thanks,
Pradeep
If you look at the code you'll see that the button state gets Xor'd, this means that you can turn the button on and off, but the functionality is removed from the menu earlier in the code, so you can turn the button on and off but the functionality remains off.....
do you mean that if i remove the following line in your code
k = DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
would serve my purpose..
that is i need your app to just toggle the state of the max button
and not its property..
Thanks in advance,
Pradeep
try it and see ;)
Its working....
Thanks crispin :)