473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to put a Icon in a Menu bar

nurikoAnna
Good day guyzz...


I want to put an icon in a menu bar ??/ It it possible???

Please help me guyzz....
Dec 22 '08 #1
4 7134
smartchap
236 100+
If you are using a toolbar goto its properties (by right clicking on it) and set icons for the items.
Dec 22 '08 #2
I'm not using tool bar..just using menu...

how to put an icon in a menu???
Dec 22 '08 #3
9815402440
180 100+
hi
declare following api functions in the form
Option Explicit

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 GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) 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 Declare Function GetMenuCheckMarkDimensions Lib "user32" () As Long

Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long

Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

add an image list control in the form and name it imgPictures
insert the required pictures in the imgPictures

now add the following code in form_load event

Dim i%
Dim hMenu, hSubMenu, menuID, x
hMenu = GetMenu(hwnd)
hSubMenu = GetSubMenu(hMenu, 0)
For i = 1 To 4
menuID = GetMenuItemID(hSubMenu, i - 1)
x = SetMenuItemBitmaps(hMenu, menuID, &H4, imgPictures.ListImages(i).Picture, imgPictures.ListImages(i).Picture)
Next
menuID = GetMenuItemID(hSubMenu, 5)
x = SetMenuItemBitmaps(hMenu, menuID, 0, imgPictures.ListImages(5).Picture, 0&)

regards
manpreet singh dhillon hoshiarpur
Dec 23 '08 #4
debasisdas
8,127 Expert 4TB
please check this.

that might be helpful to you.
Dec 23 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Lalit | last post by:
Hi Friends, I have developed a Windows service. Now i need icon for this service in systray and context menu fo this icon. Can i do this? With regards, Lalit
1
by: Jon Turlington | last post by:
My company is creating a new IEAK but how do we create the icon like the mail icon that has a drop down. I have searched endlessly and finally resorted to posting my own question. Does anyone...
7
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray...
2
by: Bonj | last post by:
Looking for a good example of how to show a popup menu in response to the user right-clicking on the icon in the 'taskbar notification area' (tray). I'm fine with creating the icon and responding to...
0
by: kapcreations | last post by:
I have a system tray app which gets the status of a windows service, and displays the appropriate icon for the status of the service in the systray. the problem I am having is the icon disapears...
0
by: Mike Eaton | last post by:
Hi there, I have an app whose structure is as follows: a module calls a custom application context containing a notify icon and associated context menu, which in turn acts upon an instance of...
1
by: liubin | last post by:
I'm trying to create a context menu that pops up upon right clicking the notify icon of my application. The menu works great with plain text... no problem. My problem is that I want to add some...
2
by: Gary Brown | last post by:
Hi, How do you remove an icon from the task switcher menu? (The one you get with ALT-TAB.) I think I asked this before but never got an answer. Now I have another app that shows an icon for...
4
by: ewokspy | last post by:
I have a system tray icon with a context menu set to appear on right-click. On a right click the menu appears fine and I can select an option. The problem is that the event doesn't fire immediately....
3
by: jctwin9 | last post by:
I've been trying to clean up the installer I created using vb 2005 as best as possible to finalize a project I am working on. I have my installer deploying a .pdf file in the application folder. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.