• GetWindowLong (VB API)

    Author
    Topic
    #365803

    I need to validate a window style to ensure the window has a sizeable border before continuing any processing. I’ve got the following so far…

    Private Declare Function GetWindowLong Lib “user32” Alias “GetWindowLongA” (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Const GWL_STYLE = (-16)

    Private Function ValidateWindowStyle() As Boolean

    Dim lResult As Long
    lResult = GetWindowLong(m_varhWnd, GWL_STYLE)

    End Function

    So ‘lResult’ returns window info, but how to compare and against which constant(s) to determine if the window is the appropriate style??

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #565459

      Dylan, I’m also having trouble finding documentation for GetWindowLong, but from this sample code from MSDN, it looks like you need

      Const WS_THICKFRAME = &H40000

      If the thickframe bit is set, then the border is not sizeable. Don’t have time to try it out, so please let us know if it works or if you find any documentation on GetWindowLong. Thanks! –Sam

      • #565460

        Sam,

        Yeah that does it – my function now looks like…

        Private Function ValidateWindowStyle() As Boolean

        Dim lResult As Long

        lResult = GetWindowLong(m_varhWnd, GWL_STYLE)
        If (lResult And WS_THICKFRAME) Then
        ValidateWindowStyle = True
        End If

        End Function

        Thanks for your help!

    Viewing 0 reply threads
    Reply To: GetWindowLong (VB API)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: