I have a MDI FORM, i have added a menu in it, now i want to add the pictures in that menu, but it is not displaying the pictures, while that same code i have tried on normal form, it works superb.but not working with MDI.

Option Explicit
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, _
ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, _
ByVal hBitmapChecked As Long) As Long
Private Sub Form_Load()
  Dim hMenu As Long
  Dim hSubMenu As Long
  Dim nPosition As Long
  Dim i As Long
  Dim x As Long
  hMenu = GetMenu(me.hwnd)
  hSubMenu = GetSubMenu(hMenu, 0)
  For i = 0 To 1
    nPosition = GetMenuItemID(hSubMenu, i)
    x = SetMenuItemBitmaps(hMenu, nPosition, 0, CLng(Picture1(i).Picture), CLng(Picture1(i).Picture))
End Sub

i have put 2 pictures boxes to add images in popup menu, same code works fine with normal form, but doesnt display pictures in MDI FORM's Menu.

Edited by peter_budo: Please use [code][/code] for multiple lines and [icode][/icode] only for single line of code

6 Years
Discussion Span
Last Post by Jaseem Ahmed

this code is not working on MDI form...i have menus on mdi form, it is not displaying pictures in menu, which i have kept on mdi form./

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.