Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Dec 9, 2000



Application Security Testing: An Integral Part of DevOps

IsFormModal - Determines whether a form is modal

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
    (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Const GWL_STYLE = (-16)
Const WS_DISABLED = &H8000000

' Return True if the form is modal
' Note: if an application has only one visible
'       form, this function considers it as modal

Function IsFormModal(frm As Form) As Boolean
    Dim f As Form
    For Each f In Forms
        If Not (f Is frm) Then
            If (GetWindowLong(f.hWnd, GWL_STYLE) And WS_DISABLED) = 0 Then
                ' there is another enabled form, so this form
                ' can't be modal
                Exit Function
            End If
        End If
    ' all other forms are disabled, therefore this form is modal
    IsFormModal = True
End Function
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date