True this
vb Code:
  1. Option Explicit
  2.  
  3. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  4. (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  5.  
  6. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  7. (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  8.  
  9. Private Declare Function SetWindowPos Lib "user32" _
  10. (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
  11. ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  12.  
  13. Private Const WS_CAPTION = &HC00000
  14. Private Const GWL_STYLE = (-16)
  15. Private Const SWP_FRAMECHANGED = &H20
  16. Private Const SWP_NOMOVE = &H2
  17. Private Const SWP_NOSIZE = &H1
  18. Private Const SWP_NOZORDER = &H4
  19.  
  20. Private Function DisplayCaption(ByVal IsDisplayed As Boolean) As Boolean
  21.         Dim MyStyle As Long
  22.        
  23.         MyStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
  24.           If IsDisplayed Then
  25.              MyStyle = MyStyle Or WS_CAPTION
  26.           Else
  27.              MyStyle = MyStyle And Not WS_CAPTION
  28.           End If
  29.          
  30.           If SetWindowLong(Me.hwnd, GWL_STYLE, MyStyle) Then
  31.              If MyStyle = GetWindowLong(Me.hwnd, GWL_STYLE) Then
  32.                 DisplayCaption = True
  33.              End If
  34.          End If
  35.          
  36.          SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_NOSIZE
  37. End Function
  38.  
  39. Private Sub Form_Load()
  40. DisplayCaption False
  41. End Sub
  42.  
  43. Private Sub Command1_Click()
  44. DisplayCaption True
  45. End Sub