473,387 Members | 1,722 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,387 software developers and data experts.

How to put a picture in a menu?

Hi all:)

I just want to put a picture in a menu list against the menu item i want...
any suggestions? plz let me
Thanx is advance:)
Jul 9 '07 #1
7 1216
debasisdas
8,127 Expert 4TB
There is no direct method to achieve the same.

You need to use API functions.
Jul 9 '07 #2
There is no direct method to achieve the same.

You need to use API functions.
hi frnd,

can u plz tell me the API name & it's implementation:)
Jul 9 '07 #3
debasisdas
8,127 Expert 4TB
You need to use the following API

Expand|Select|Wrap|Line Numbers
  1. Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
  2. Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  3. Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  4. Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  5. Public 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 Any) As Long
  6. Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
  7. Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Jul 9 '07 #4
Killer42
8,435 Expert 8TB
You need to use the following API...
Could you provide a quick sample of how to do it? I'd like to put it in the Articles section.
Jul 10 '07 #5
debasisdas
8,127 Expert 4TB
You can try this following sample.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   Picture1.Picture = LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Bitmaps\OffCtlBr\Small\Color\CUT.BMP")
  3.   Dim D As Long
  4.   Dim H As Long
  5.   D = CreateCompatibleDC(Picture1.hdc)
  6.   H = CreateCompatibleBitmap(Picture1.hdc, 16, 16)
  7.  
  8.   Dim P As Long
  9.   P = SelectObject(D, H)
  10.   DU = BitBlt(D, 0, 0, 16, 16, Picture1.hdc, 0, 0, &HCC0020)
  11.   DU = SelectObject(D, P)
  12.   D = ModifyMenu(GetSubMenu(GetMenu(Me.hwnd), 0), 0, &H404, 0, H)
  13. End Sub
Jul 10 '07 #6
Killer42
8,435 Expert 8TB
What is DU?

Do you work without Option Explicit? If so, I think it's a really bad idea. Makes it much too easy to accidentally slip in non-existent variables.
Jul 10 '07 #7
debasisdas
8,127 Expert 4TB
that is also LONG type.


thanx for pointing to the mistake...
Jul 12 '07 #8

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

Similar topics

3
by: jeff | last post by:
Hiya, Im currently in the process of developing a picture browser, I want it to run off a CD, basically I have 2 questions for the group. The first is how do I get the program to only view the...
7
by: Michael Jaeger | last post by:
Dear ciwah, I'm in the process of designing a German school web site, and I need the help of you experts. I wrote the navigation (CSS based, no javascript), which looks OK in IE, Firefox and...
3
by: | last post by:
I have an interactive mapping website where there is a main map image. For the map image, I over-rode the default right click menu to provide a popup menu for mapping tools. Now my client has asked...
2
by: Lyn | last post by:
I am trying to embed a picture into a Bound Object Frame (Me!Photograph) with the following code which is based on MS article http://support.microsoft.com/?id=158941: strPathname =...
0
by: Lyn | last post by:
This one is driving me crazy. I have a table which stores pictures in an OLE Object column, one per record with a few other text fields (caption, date, etc). This table is maintained with a...
2
by: beanimanius | last post by:
working with about 100 picture boxes (not very big, 42X8) 1 image list of 5 pictures hopefully 1 context menu how do you program a contex menu so that it knows what picture box you are clicking...
2
by: Casey Miller | last post by:
I have a site, http://www.onemorewebsite.com, that has a menu on the left side and a picture on the right side with a middle div for content in the middle. When I mouse over the menu, the picture...
1
by: nowitsoverx | last post by:
I'm just trying to test something out to see if I can get it working but I'm a little stuck. I have two frames. The left one has a menu of radio buttons. I want it so when you click on the radio...
1
by: swethak | last post by:
Hi, I have one normal picture is there.How to add the menu bar to the picture and take options as Halfsize, Normal size,Rotateleft ,save,close like that using javascript.plz tell that how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
jinu1996
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 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.