Hi, All
Is it possible to add icons in place of menu names in Menu Editor or any other way
4 3686
Hi, All
Is it possible to add icons in place of menu names in Menu Editor or any other way
Hi anuragshrivastava,
Give this a try.
this is for VB6
Add a new Module (default name)
Add this code: - Option Explicit
-
-
Public Const MF_BITMAP = &H4&
-
Public Const MIIM_ID = &H2
-
Public Const MIIM_TYPE = &H10
-
Public Const MFT_STRING = &H0&
-
-
Public Type MENUITEMINFO
-
cbSize As Long
-
fMask As Long
-
fType As Long
-
fState As Long
-
wID As Long
-
hSubmenu As Long
-
hbmpChecked As Long
-
hbmpUnchecked As Long
-
dwItemData As Long
-
dwTypeData As String
-
cch As Long
-
End Type
-
-
Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
-
Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Boolean, lpMenuItemInfo As MENUITEMINFO) As Boolean
-
Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
-
Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
-
Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
-
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
================================================== =====
On the Form add these menu's.....
mnuFile
mnuOpen
mnuSave
also add 3 pictureboxes ( 1 and 2 with the pictures you want in the menu, 3 left blank) and set properties Visible = False
CODE: VB 6 - Option Explicit
-
-
Private Sub Form_Load()
-
On Error GoTo err
-
Dim hMenu As Long, hSubmenu As Long
-
Dim hID As Long
-
-
Me.Hide
-
-
'Get the menuhandle of your app
-
hMenu = GetMenu(Me.hwnd)
-
-
'Get the handle of the first submenu (Hello)
-
hSubmenu = GetSubMenu(hMenu, 0)
-
-
'Get the menuId of the first entry (Bitmap)
-
hID = GetMenuItemID(hSubmenu, 0)
-
-
'Add the bitmap
-
'You can add two bitmaps to a menuentry
-
'One for the checked and one for the unchecked
-
'state.
-
SetMenuItemBitmaps hMenu, hID, MF_BITMAP, Me.Picture1.Picture, Me.Picture2.Picture
-
-
' repop the picture box
-
Set Me.Picture3.Picture = LoadPicture(App.Path & "\lake.bmp")
-
-
' do the next submenu
-
hID = GetMenuItemID(hSubmenu, 1)
-
-
' add the bitmap
-
SetMenuItemBitmaps hMenu, hID, MF_BITMAP, Me.Picture3.Picture, Me.Picture3.Picture
-
-
Me.Show
-
Exit Sub
-
err:
-
err.Clear
-
Me.Show
-
End Sub
Let us know if you have any luck with this.
GobbleGob.
Sorry sir but is there anything else i've to do
Its not working at all
Sorry sir but is there anything else i've to do
Its not working at all
What errors you getting?
I tried out an idea and it might help...
Use a toolstrip and dock it to the top of your form, add a button to the toolstrip and change the image... works for me...
JAmes
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Raymond H. |
last post by:
Hello,
1- How to see, in a Label, the URL of a link that the mouse pass over?
(in the WebBrower control in a vb projet).
2- How to create a menu and a submenu via a button Command1? and...
|
by: Nutshell |
last post by:
Hi,
I created a web page which contains table. I use table cells to display a
picture using <img src>. The problem is that some pictures are not being
fully displayed, only a quarter of the left...
|
by: Jenni |
last post by:
Quick question: What is the best way to include pictures in a database.
I am making one that allows folks to sort through a bunch of jpg's. The
only way I can figure out is to insert an OLE object,...
|
by: news.microsoft.com |
last post by:
Hello and first of all thank you for your time.
I am currently developing an ASP.net web page, which has data stored in SQL
Server. It is a web page for a State Agent and my problem is:
I need...
|
by: iwdu15 |
last post by:
hi, i was wondering if there was anyway to put icons/images next to menu
items? thanks
| |
by: Rich |
last post by:
Hello,
I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
on a form or pannel container. If I place a picture box on my container
form/pannel and dimension it to the...
|
by: DSchlichte |
last post by:
Hello
' I need some help. I've created a little application to paint, save and
load pictures (Bitmap-graphics) into
' a picturebox-object on the desktop. There's no problem to paint or to load...
|
by: JT |
last post by:
Okay, I've seen about 4 years' worth of posts about this with no
viable solutions. I've spent 9 hours today trying to fix this. It
works BEAUTIFULLY on my local IIS installation, but when I...
|
by: =?Utf-8?B?bm9yZHkyMDA=?= |
last post by:
The first bunch of pictures I downloaded to my computer I could resize by
right clicking and the drop down menu would have an item that seaid resize. I
resized to a large email format, saved that...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |