CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 1999
    Posts
    18

    [Q]: How to disable the size option from my app menu



    I made an app that is sizeable, but i disabled the maximize box. i want it so it can either be minimized or if you click on its icon in the tray have it return to its normal state. it does those fine, but if you left click on the app icon in the upper left corner, the menu alows you to size it. how can i remedy this?

    thanks,

    jeremy

  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: [Q]: How to disable the size option from my app menu



    Hi


    You say you made your app sizable yet you don't want to see the option in the system menu ?


    If you don't want the user to resize your app at all, you can do it using the following code :


    Create a new VB project, and paste the following code into the code section of form1


    Option Explicit


    Private Declare Function GetSystemMenu Lib "user32" _

    (ByVal hWnd As Long, ByVal bRevert As Long) As Long

    Private Declare Function RemoveMenu Lib "user32" _

    (ByVal hMenu As Long, ByVal nPosition As Long, _

    ByVal wFlags As Long) As Long


    Private Const MF_BYPOSITION = &H400&



    Public Sub RemoveResizeMenuItem()

    Dim hSysMenu As Long

    'get the system menu for this form

    hSysMenu = GetSystemMenu(Me.hWnd, 0)

    'remove the close item

    Call RemoveMenu(hSysMenu, 2, MF_BYPOSITION)

    End Sub


    Private Sub Form_Load()

    RemoveResizeMenuItem

    End Sub


    Hope it helps


    Regards


    Chris Eastwood

    Software Engineer

    ACNielsen Ltd


    CodeGuru - the website for developers

    http://www.codeguru.com

  3. #3
    Join Date
    Jan 1999
    Posts
    18

    Re: [Q]: Perfect, Thanks. N/T



    N/T

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

Featured