Regarding menu of Mdi Child Form

Nitin Garg
05-02-2002, 11:47 PM
Hi guys...

I am facing a problem. I have a mdi child form having a menu which is invisible because i use this menu as context menu.
But when i show that child form, the menu bar of MDI Form disappear (as it tries to nagotiate menu of child form with mdi form).

Is it possible to show the menus of mdi form visible when a child form having its own menus is visible.

Please tell me how.

Banjo
05-03-2002, 04:18 AM
There are two ways that I can think, neither are particularly pretty.

1) Create the popup dynamically using API calls. here's an example:
Private Sub ShowPluginPopup(ByVal X As Long, ByVal Y As Long)
Dim hMenu As Long, rc As Long
Dim nameStr As String
Dim As POINTAPI
Dim mi As MENUITEMINFO

hMenu = CreatePopupMenu
nameStr = "Manual Update" & Chr(0)
rc = AppendMenu(hMenu, MF_STRING, 0, nameStr)
mi.cbSize = Len(mi)
mi.fMask = MIIM_ID
mi.wID = 100
rc = SetMenuItemInfo(hMenu, 0, MF_BYPOSITION, mi)

nameStr = "Settings" & Chr(0)
rc = AppendMenu(hMenu, MF_STRING, 0, nameStr)
mi.cbSize = Len(mi)
mi.fMask = MIIM_ID
mi.wID = 101
rc = SetMenuItemInfo(hMenu, 1, MF_BYPOSITION, mi)

rc = DrawMenuBar(hMenu)

.X = X / 15: .Y = Y / 15
ClientToScreen lstPlugins.hwnd,
rc = TrackPopupMenu(hMenu, TPM_RETURNCMD Or TPM_TOPALIGN Or TPM_LEFTALIGN, .X, .Y, 0, Me.hwnd, 0)

Select Case rc
Case 100
ShowManual lstPlugins.ListIndex

Case 101
ShowSettings

End Select

rc = DestroyMenu(hMenu)
End Sub

2) Use the SetParent API to move another form inside the MDI Child. Put your menus on that form instead.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum