Advertisement
3_2004-2005 Windows API Call/ Explanation #139688

Toggle a Form's Caption Bar at Runtime

This code allows a user to Toggle the caption bar (toolbox and all) on a form at runtime. Normally you cannot visually change some of the form's settings at runtime this solves one of those instances. Code can be fairly easily changed so as to accept a parameter for if you want the caption or not. This is just a simple example.

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Private Sub ToggleFormCaption()
  Dim rcWindow As RECT
  Dim lRet As Long
  lRet = GetWindowRect(Me.hwnd, rcWindow)
  lRet = SetWindowLong(Me.hwnd, GWL_STYLE, GetWindowLong(Me.hwnd, GWL_STYLE) Xor WS_CAPTION)
  lRet = SetWindowPos(Me.hwnd, 0, 0, 0, rcWindow.Right - rcWindow.Left + 1, rcWindow.Bottom - rcWindow.Top, SWP_NOMOVE)
  lRet = SetWindowPos(Me.hwnd, 0, 0, 0, rcWindow.Right - rcWindow.Left, rcWindow.Bottom - rcWindow.Top, SWP_NOMOVE)
End Sub
Původní komentáře (3)
Obnoveno z Wayback Machine