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

    how to show/hide title and menu bar?

    Anybody can tell me how to show/hide the titlebar & menu bar? i know how to hide menu bar, but when i has a menu bar in the form, no mater show or hide, when i set the boder property to no boder, there is always a title bar shown,
    so what should i do? thanx very much


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: how to show/hide title and menu bar?

    Try this in the Forms General Declarations Section:

    private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (byval hwnd as Long, byval nIndex as Long, byval dwNewLong 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 SetWindowPos Lib "user32" (byval hwnd as Long, byval hWndInsertAfter as Long, byval x as Long, byval y as Long, byval cx as Long, byval cy as Long, byval wFlags as Long) as Long

    private Const GWL_STYLE = (-16)
    private Const WS_BORDER = &H800000
    private Const WS_CAPTION = &HC00000
    private Const SWP_FRAMECHANGED = &H20
    private Const SWP_NOMOVE = &H2
    private Const SWP_NOSIZE = &H1
    private Const SWP_SHOWWINDOW = &H40

    private Sub Form_Load()
    Call SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Xor WS_CAPTION Xor WS_BORDER)
    Call SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW)
    End Sub




    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

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