[RESOLVED] Find out if Form is shown modally
I have 2 Forms.
"Form1" has a menu. "Form2" is shown modally. I also have a tray icon representing the application.
Here is my problem.
Since "Form2" is shown modally - whenever i try to popup the menu from "Form1" via tray icon i get error. That's normal.
Until now i have been putting some String into "Form2" Tag property so i knew it was shown modally. This works fine.
However, i am interested if there's some other, more "official" way to find out if some Form is shown modally?
Thanks :)
-gav
Re: Find out if Form is shown modally
A google search returned the Answer :D
http://support.microsoft.com/kb/77316
Re: Find out if Form is shown modally
Thank you :thumb:
Here's the "complete" solution:
VB Code:
'declarations
Option Explicit
Public Const WS_DISABLED = &H8000000
Public Const GWL_STYLE As Long = (-16)
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'syntax
Sub Test()
If (GetWindowLong(Form1.hWnd, GWL_STYLE) And WS_DISABLED) <> 0 Then
'Form1 is Modal...
End If
End Sub