CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2001
    Posts
    44

    menu and toolbar question

    How can I add an icon in menu? is it posibble
    How can I do dockable toolbar like Office style
    thanks


  2. #2
    Join Date
    May 2001
    Posts
    24

    Re: menu and toolbar question

    Add the Icon in menu


    Declare Function GetMenu Lib "user32" _
    (byval hwnd as Long) as Long

    Declare Function GetSubMenu Lib "user32" _
    (byval hMenu as Long, byval nPos as Long) as Long

    Declare Function GetMenuItemID Lib "user32" _
    (byval hMenu as Long, byval nPos as Long) as Long

    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

    Declare Function GetMenuItemCount Lib "user32" _
    (byval hMenu as Long) as Long

    Declare Function GetMenuItemInfo Lib "user32" _
    Alias "GetMenuItemInfoA" (byval hMenu as Long, _
    byval un as Long, byval b as Boolean, _
    lpMenuItemInfo as MENUITEMINFO) as Boolean


    public Const MF_BITMAP = &H4&

    Type MENUITEMINFO
    cbSize as Long
    fMask as Long
    fType as Long
    fState as Long
    wID as Long
    hSubMenu as Long
    hbmpChecked as Long
    hbmpUnchecked as Long
    dwItemData as Long
    dwTypeData as string
    cch as Long
    End Type '


    public Const MIIM_ID = &H2
    public Const MIIM_TYPE = &H10
    public Const MFT_STRING = &H0&

    public Sub ImgInPopUpMenu()

    hMenu& = GetMenu(Main.hwnd)

    hSubMenu& = GetSubMenu(hMenu&, 0)
    ' 3 is number of submenu have icon
    hID& = GetMenuItemID(hSubMenu&, 3)
    SetMenuItemBitmaps hMenu&, hID&, MF_BITMAP, _
    Main.Picture1.Picture, _ 'Add picture
    Main.Picture1.Picture

    End Sub





    Gordon Ngai



  3. #3
    Join Date
    Aug 2001
    Posts
    31

    Re: menu and toolbar question

    how can i use this??




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

Featured