Martin2k Forums

Board index Visual Basic Visual Basic Help

[VB6] - put icons in menus

Ask for help on versions of Visual Basic 6.0 or earlier.

[VB6] - put icons in menus

Postby cambalinho » Tue Jun 14, 2011 1:55 pm

i have 1 code for put images on menu:
Private Sub Command1_Click()
Dim pObject As Long
Dim dcMemory As Long
Dim hMemoryBitmap As Long
Dim dummy As Long
dcMemory = CreateCompatibleDC(Picture1.hdc)
hMemoryBitmap = CreateCompatibleBitmap(Picture1.hdc, Picture1.ScaleWidth \ Screen.TwipsPerPixelX, Picture1.ScaleHeight \ Screen.TwipsPerPixelY)

pObject = SelectObject(dcMemory, hMemoryBitmap)
dummy = BitBlt(dcMemory, 0, 0, Picture1.ScaleWidth \ Screen.TwipsPerPixelX, Picture1.ScaleHeight \ Screen.TwipsPerPixelY, Picture1.hdc, 0, 0, &HCC0020)
dummy = SelectObject(dcMemory, pObject)
dummy = ModifyMenu(GetSubMenu(GetMenu(Me.hwnd), 0), 0, &H404, 0, _
hMemoryBitmap)
End Sub

i can see 2 things in these code:
1- why the caption is losed?
2 - why, when the item is selected(mouse move), the image is inverted?
User avatar
cambalinho
Newcomer
 
Posts: 3
Joined: Sun Jun 12, 2011 11:41 pm
Location: Protugal, Viseu, Oliveira de Frades

Re: [VB6] - put icons in menus

Postby Keith » Wed Jun 15, 2011 6:53 pm

There are loads of ways to add pics to menu items. The common way is to add all the pics to an ImageList. I can't see your full code so I can't see why the Caption is lost?
You do not have the required permissions to view the files attached to this post.
I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Image
Keith
Administrator
 
Posts: 869
Joined: Tue Oct 13, 2009 12:15 am
Location: Stoke on Trent, England
Medals: 1
6 Star (1)

Re: [VB6] - put icons in menus

Postby khin-chan » Thu Apr 12, 2012 11:13 pm

yea, thank you so much for the information. but can you do me a favor?
can you help me with a project that involves access and the data base
i want to make a registry of a library and stuff
how can i open or use the database in vb
please help,
sincerely,
khin-chan

Edit: Keith email removed as you'll get loads of spam.
khin-chan
Newcomer
 
Posts: 1
Joined: Thu Apr 12, 2012 11:06 pm

Re: [VB6] - put icons in menus

Postby Keith » Fri Apr 13, 2012 1:46 am

Welcome to the forum khin-chan. :vbwelcome:

Well there are different ways to make database apps ADO, Adodc, OLE DB, ODBC, RDS, DAO, Jet, JRO, and the old Data control. ADO, DAO, Adodc and the Data control are the common ones used.

I would think the easiest way is to search PSC as there are thousands of database apps on there so you can choose which way suits you the best.
I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Image
Keith
Administrator
 
Posts: 869
Joined: Tue Oct 13, 2009 12:15 am
Location: Stoke on Trent, England
Medals: 1
6 Star (1)


Return to Visual Basic Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron