Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    GetWindowLong (VB API)

    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

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: GetWindowLong (VB API)

    Dylan, I'm also having trouble finding documentation for GetWindowLong, but from <A target="_blank" HREF=http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/html/msdn_msdn109.asp>this</A> sample code from MSDN, it looks like you need <pre>Const WS_THICKFRAME = &H40000</pre>

    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
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetWindowLong (VB API)

    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!

Posting Permissions

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