SBEIHIyad-シリア-ダマスカスによって書かれました。2021年4月1日。
VB6.0を使用すると、次のことが可能になります。すべてのメニューウィンドウが開いているかどうかを確認します。つまり、メニューが開いています。メインメニューのhWndにAPI"GetMenu"を使用し、次にAPI "GetMenuState"を使用して、メニューの1つが開いているかどうかを確認します。
Vb6.0コード:
Private Function GetBit_I(ByVal X As Long, ByVal i As Integer) As Integer
' Get the bit number i of X.
GetBit_I = (X And (2 ^ i)) / (2 ^ i)
End Function
Private Function MainMenuIsOpened(FRM As Form) As Boolean
Const MF_BYPOSITION = 1024
Dim H As Long, i As Integer, L As Long, MCount As Long
MainMenuIsOpened = False
On Error GoTo MainMenuIsOpenedError
H = GetMenu(FRM.HWnd)
MCount = GetMenuItemCount(H)
' MCount is the number of main-menus.
Do While (i < MCount)
L = GetMenuState(H, i, MF_BYPOSITION)
If ((L > -1) And (GetBit_I(L, 7) = 1)) Then
MainMenuIsOpened = True
Exit Do
End If
i = i + 1
Loop
Exit Function
MainMenuIsOpenedError:
MainMenuIsOpened = False
End Function
幸運を。