hi,

how can i check if a window is a modal one or not. i tried out
GetWindowLong/GWL_STYLE with a bunch of styles that could fit
this criteria (WS_EX_TOPMOST,...) but it didn't worked...

i need something like: boolean IsModal(dword hwnd)
anybody knows how to do that?
Posted on 2003-03-24 07:40:41 by mob
Does this code snippet help (beware, VB :) )?



Public Function IsWindowModal(ByVal lngHwnd As Long) As Boolean

Dim rtn As Long
rtn = GetWindowLong(lngHwnd, GWL_EXSTYLE)
Debug.Print rtn
If rtn And &H40000 Then
IsWindowModal = False
Else
IsWindowModal = True
End If

End Function
Posted on 2003-03-24 07:49:00 by Delight
mh are you sure? i get 500+ modal results and 5 non modal windows....
maybe the word "modal" is wrong... i mean these child windows where
you're not able to work with the main-app anymore (the "save as"
dialog is what i consider as "modal" for example)... i just need to check
this behaviour... is that possible?
Posted on 2003-03-24 08:08:48 by mob
I think that that would be a task-modal window. Couldn't you just do a GetParent and if it returns non-null then it is task modal ?
Posted on 2003-03-24 08:30:33 by donkey