Click to See Complete Forum and Search --> : API Call To Change BorderStyle
scotty85_2000
Oct 23rd, 2001, 11:51 AM
Is there an API call to change the border style of a window to the none state (0) and the bordered state (2)? I've tried using:
Me.BorderStyle = 0
But, you can't change a read-only property at runtime. So could someone post the API calls for doing the above? Thanking you in advance...
Serge
Oct 23rd, 2001, 12:51 PM
Option Explicit
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 Const GWL_STYLE = (-16)
Private Const WS_BORDER = &H800000
Private Sub Command1_Click()
Dim lngStyle As Long
lngStyle = GetWindowLong(Form1.hwnd, GWL_STYLE) And (Not WS_BORDER)
Call SetWindowLong(Form1.hwnd, GWL_STYLE, lngStyle)
Form1.WindowState = vbMinimized
Form1.WindowState = vbNormal
End Sub
scotty85_2000
Oct 23rd, 2001, 01:08 PM
Is that the coding to make the window have a border or to borderless? And if both, how do I make a distinction between the two?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.