Results 1 to 3 of 3

Thread: API Call To Change BorderStyle

  1. #1

    Thread Starter
    Addicted Member scotty85_2000's Avatar
    Join Date
    Feb 2001
    Posts
    198

    API Call To Change BorderStyle

    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...
    100 posts... All of them have been "How Do I's", "Can You's", "HELP ME!!'s"...
    Still, at least they've been relevant..

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    VB Code:
    1. Option Explicit
    2. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    3. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    4. Private Const GWL_STYLE = (-16)
    5. Private Const WS_BORDER = &H800000
    6.  
    7. Private Sub Command1_Click()
    8.     Dim lngStyle As Long
    9.    
    10.     lngStyle = GetWindowLong(Form1.hwnd, GWL_STYLE) And (Not WS_BORDER)
    11.     Call SetWindowLong(Form1.hwnd, GWL_STYLE, lngStyle)
    12.     Form1.WindowState = vbMinimized
    13.     Form1.WindowState = vbNormal
    14. End Sub

  3. #3

    Thread Starter
    Addicted Member scotty85_2000's Avatar
    Join Date
    Feb 2001
    Posts
    198
    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?
    100 posts... All of them have been "How Do I's", "Can You's", "HELP ME!!'s"...
    Still, at least they've been relevant..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width