skullb
Dec 14th, 2000, 12:30 PM
I have a form with border style=1 (resizable with caption set to none and no control box ... what I want to do is set caption to the form ONLY when it is minimized (so the user knows what app is it ... and for the caption to dissaper when I restore the form ...
any ideas ?
thanks
Aaron Young
Dec 14th, 2000, 03:01 PM
Try: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 WS_CAPTION = &HC00000
Private Const GWL_STYLE = (-16)
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Sub Form_Load()
Dim W As Integer
Dim H As Integer
W = ScaleX(Width, ScaleMode, vbPixels)
H = ScaleY(ScaleHeight, ScaleMode, vbPixels)
Caption = "Captionless Form with Icon"
Call SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Xor WS_CAPTION)
Call SetWindowPos(hwnd, 0&, 0&, 0&, W, H, SWP_NOMOVE Or SWP_FRAMECHANGED)
End Sub