Results 1 to 5 of 5

Thread: Regarding Menu

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    -
    Posts
    101
    hi! how can i put a bmp/icon image on my menu? (just like in icq)

    thanks.

    - i'm using VB 6.0 enterprise edition
    icq: 16228887

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Here's a quick example, add a menu and a picturebox (containing the image you want to appear in the menu) to a form:
    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 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 Const MF_BYPOSITION = &H400&
    
    Private Sub Command1_Click()
        Dim lMenu As Long
        Dim lMenuID As Long
        
        'Get the Menu Handle of the Form
        lMenu = GetMenu(Form1.hwnd)
        'Get the Menu Handle of the first SubMenu
        lMenu = GetSubMenu(lMenu, 0)
        'Add the bitmap to the First Item (Zero), in the SubMenu
        SetMenuItemBitmaps lMenu, 0, MF_BYPOSITION, Picture1.Picture, Picture1.Picture
    End Sub

  3. #3
    Guest

    Wink Or you could

    Logginto http://www.vbaccelerator.com and download their menu control, also you will need the ssubtmr.dll from their site. Just a thought.

  4. #4
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    Or make your own Owner-Drawn menus.

    (The hardest way of them all, but also the flashiest)

    This was obviously the route I took.

    I can give you some source code, but that VBaccelerator thing is probably best.
    Courgettes.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    -
    Posts
    101
    Thanks Aaron for the code. I tried it and it did work.

    I'll try to checkout the site Jethro. I'm sure I can get some usefull codes


    V(ery) Basic, I'll appreciate it if u'll send me some of ur code. can u mail it to [email protected]?

    Thanks a lot guys!
    icq: 16228887

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