Results 1 to 11 of 11

Thread: Icon in Menu

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    27
    Hi ppl,

    Does anyone know how you add icons in the menus like in Microsoft office or any sites that I can go to to get sample code example on how to do this.

    Cheers

    AD

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Try:
    Code:
    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 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
    Const MF_BITMAP = &H4&
    
    Private Sub Command1_Click()
        Dim hMenu As Long, hSub As Long, ItemID As Long
        hMenu = GetMenu(Me.hwnd)
        hSub = GetSubMenu(hMenu, 0)
        ItemID = GetMenuItemID(hSub, 0)
        SetMenuItemBitmaps hMenu, ItemID, MF_BITMAP, Picture1, Picture1
    End Sub
    'I'm not sure who's code it is, but i belive i've seen Magatron post it.
    You can also search for examples on Planet Source Code

    Gl,
    D!m

    [Edited by Dim on 09-13-2000 at 01:44 AM]
    Dim

  3. #3
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    (a la Phoebe)
    Ooh. Ooh. Ooh

    I've made somthing perfect for this, unless you are going to need submenus.

    I'll e-mail it to you whether you like it or not ...
    Courgettes.

  4. #4
    New Member
    Join Date
    Sep 2000
    Location
    Hell
    Posts
    4
    Well. Actually I can't e-mail it to you since you don't seem to have an e-mail

    That's a real pity.

    I thought I'd get to send it to somebody else.


    Anyhow, I think that there is something

    hyah

    But if it is the exaple I think it is, mine is a whole world better.

    (Not showing off or anything )
    You wouldn't know a joke if it got up and gave you a haircut.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    27
    Thank for the help dudes.
    Okay here's my email [email protected] and don't mail me any sick stuff or porn.

    I havent been on the net for a few day cause I got the flu and I been taking echinacea before I got sick. What a crock I still got sick that herbal remedy is a fake!!

  6. #6
    Guest
    VBThunder has a very good example for OFFICE-STYLE popup menus that rule. You could use that way, but it really supports only 10x10 graphics.

    ___________________
    Goto: http://www.vbthunder.com/

  7. #7
    Guest
    D!m: Yes I'm pretty sure that was me. I think the bitmap has to be 13x13 in order for it to fit.

  8. #8
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    Well I rule on menus, so I'l send ya that popup menu example

    It supports enablng/disabling boldening, italicising, underlining, submenus and different background colours.
    Courgettes.

  9. #9
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    I'd really like your menu demo also .

    [email protected] if you would be so kind .

    Thanks
    []Private[]
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  10. #10
    Guest
    vbaccelerator (www.vbaccelerator.com) has an ace dll thng for putting pics menus, and creating them at runtime etc. Well worth a look (like the rest of his site)

    - gaffa

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    27

    Thumbs up

    Thanks V(ery) Basic. He's right, he does definitely rule



    Having so much fun..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width