Dim
MainMenu As Long, FileMenu As Long
Dim x As Long, y As Long
MainMenu = GetMenu(Me.Hwnd)
FileMenu = GetSubMenu(MainMenu, 0)
So, we declare
some variables and retrieve the handle of the main menu. Then,
using GetSubmenu, we retrieve the handle of the first submenu.
For
x = 0 To 5
y = GetMenuItemID(FileMenu, x)
ModifyMenu FileMenu, x, MF_BYPOSITION Or MF_OWNERDRAW, y, x
Next x
Get the
menu ID (it is required by ModifyMenu, otherwise we don't need
it), set MF_OWNERDRAW flag and specify the application defined
32-bit value to the corresponding number for each menu item.
DispStatus "Own Menu Created"
Command1.Enabled = True
Display
message and disable Command1