Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
OISV - Organization of Independent Software Vendors - Contributing Member
VB projects - Menu with images

Description: adding images to menu items
Minimum requirements: VB6
Download: source code
Screenshot:
VB projects - Menu with images
Project: EXE
Controls: PictureBox Picture1 (AutoSize = -1 'True, Index = 0), PictureBox Picture1 (AutoSize = -1 'True, Index = 1), PictureBox Picture1 (AutoSize = -1 'True, Index = 2),
Additional references: none
Code:
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 2 nPosition = GetMenuItemID(hSubMenu, i) x = SetMenuItemBitmaps(hMenu, nPosition, 0, CLng(Picture1(i).Picture), CLng(Picture1(i).Picture)) Next End Sub

Copyright © 1996-2013 OstroSoft. All rights reserved. info@ostrosoft.com