Click to See Complete Forum and Search --> : how to show/hide title and menu bar?


wildleopard
November 22nd, 1999, 03:09 AM
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

Aaron Young
November 22nd, 1999, 03:16 PM
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
adyoung@win.bright.net
aarony@redwingsoftware.com