Results 1 to 8 of 8

Thread: (Resolved)....Disable Internet Explorer Maximize button....

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    137

    (Resolved)....Disable Internet Explorer Maximize button....

    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.
    Last edited by vbBoy; Nov 22nd, 2001 at 12:55 PM.

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    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
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    137

    Thanxs crispin

    It did help.

    _______________________________________________

    vbBoy.

  4. #4
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    hi crispin

    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

  5. #5
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    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.....
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  6. #6
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534
    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

  7. #7
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    try it and see
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  8. #8
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    wow

    Its working....

    Thanks crispin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width