Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2006, 12:53 AM
Registered User
 
Join Date: Jan 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating Menu Icons

Please tell me how u can create icons to the left of menu
items in a VB Application.such menu icons can be seen in
applications like MS Word

 
Old January 23rd, 2006, 04:26 AM
Registered User
 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ChinaWolf
Default

definde function API .

Private Declare Function GetMenu Lib "user32" (ByVal hwnd 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
Now we can add icon to menu.
'ÏÂÃæÊdzÌÐò¿ªÊ¼¡£
Dim sHandle As Long, mHandle As Long
mHandle = GetMenu(frm.hwnd) 'get handle of the menu
sHandle = GetSubMenu(mHandle, 0) 'get handle of submenu
SetMenuItemBitmaps sHandle, 0, &H400&, img.ListImages(1).Picture, img.ListImages(1).Picture
'add icon
'we add an icon to menu from imglist,well you can add icon from picturebox or imagebox.

 
Old January 23rd, 2006, 04:28 AM
Registered User
 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ChinaWolf
Default

Const MF_BYPOSITION = &H400&
This is constant define,sorry,I forgot!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Context Menu icons aldwinenriquez .NET Framework 2.0 1 March 3rd, 2011 01:43 AM
Icons in Menu ashu_from_india Pro VB 6 2 June 3rd, 2005 10:58 PM
Menu Icons snowy0 VB.NET 2002/2003 Basics 2 September 28th, 2004 08:09 PM
Creating shortcut icons Ray Pinnegar Access VBA 0 August 23rd, 2004 03:06 AM
Creating simple Menu godhsf80 Javascript 1 November 30th, 2003 12:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.