True thisvb Code:
Option Explicit 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 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 WS_CAPTION = &HC00000 Private Const GWL_STYLE = (-16) Private Const SWP_FRAMECHANGED = &H20 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 Private Const SWP_NOZORDER = &H4 Private Function DisplayCaption(ByVal IsDisplayed As Boolean) As Boolean Dim MyStyle As Long MyStyle = GetWindowLong(Me.hwnd, GWL_STYLE) If IsDisplayed Then MyStyle = MyStyle Or WS_CAPTION Else MyStyle = MyStyle And Not WS_CAPTION End If If SetWindowLong(Me.hwnd, GWL_STYLE, MyStyle) Then If MyStyle = GetWindowLong(Me.hwnd, GWL_STYLE) Then DisplayCaption = True End If End If SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_NOSIZE End Function Private Sub Form_Load() DisplayCaption False End Sub Private Sub Command1_Click() DisplayCaption True End Sub




Reply With Quote