Results 1 to 30 of 30

Thread: Menu color changes?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25

    Menu color changes?

    I am playing around with creating a simple customized web Browser .
    And i was wondering if anyone here knows how to change the default menu colors or possibly even use a picture as a background for a menu ( in code or settings).


    anyone have an idea

    [Resolved]
    Last edited by High_Octane; Dec 10th, 2003 at 05:24 PM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    is it even possible?
    [Resolved]
    Last edited by High_Octane; Dec 10th, 2003 at 05:24 PM.

  3. #3
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Not sure about background colors (it is possible with API i bet.) but you could use a XP Style Menu, look here:

    HERE

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    sweet that looks way better allready thx dude

  5. #5
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    No probs, id also reccomend downloading the sample project. You can add icons and everything. Only problem is, someone recently told me it doesnt run on XP, i have yet to find out. Until then im having a buzz with this control

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    hmm downloaded and i am going through the help stuff to see how to use use is it in the help code:
    VB Code:
    1. Private Sub Form_MouseDown( _
    2.     Button As Integer, _
    3.     Shift As Integer, _
    4.     X As Single, Y As Single)
    5.      
    6.     Dim pt As POINTAPI
    7.      
    8.     If Button <> vbRightButton Then Exit Sub
    9.      
    10.     pt.X = Me.ScaleX(X, vbTwips, vbPixels)
    11.     pt.Y = Me.ScaleY(Y, vbTwips, vbPixels)
    12.     ClientToScreen Me.hWnd, pt
    13.      
    14.     pShowMenu pt.X, pt.Y
    15.      
    16. End Sub
    17.  
    18. Private Sub pShowMenu(ByVal X As Long, ByVal Y As Long)
    19.  
    20.     m_MenuHandle = CreatePopupMenu()
    21.      
    22.     AppendMenu m_MenuHandle, MF_STRING Or MF_OWNERDRAW, 1, 1
    23.     AppendMenu m_MenuHandle, MF_STRING Or MF_OWNERDRAW, 2, 2
    24.     AppendMenu m_MenuHandle, MF_SEPARATOR Or MF_OWNERDRAW, 3, 3
    25.     AppendMenu m_MenuHandle, MF_STRING Or MF_OWNERDRAW, 4, 4
    26.      
    27.     TrackPopupMenuEx _
    28.         m_MenuHandle, _
    29.         TPM_LEFTALIGN Or TPM_TOPALIGN Or TPM_LEFTBUTTON, _
    30.         X, _
    31.         Y, _
    32.         Me.hWnd, _
    33.         0
    34.  
    35. End Sub

    They define pt As pointAPI wich seems to cuase a problem for me cause POINTAPI does not show up as any of my AS types
    do i need to declare PointAPI as something ?[RESOLVED]

    PS:imgonna go check out that demo now see if i get any help there
    Last edited by High_Octane; Dec 10th, 2003 at 05:18 PM.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    PointAPI definition.
    VB Code:
    1. Private Type POINTAPI
    2.     x As Long
    3.     y As Long
    4. End Type
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    Try this:

    VB Code:
    1. Private Enum MENUINFO_STYLES
    2.         MNS_NOCHECK = &H80000000
    3.         MNS_MODELESS = &H40000000
    4.         MNS_DRAGDROP = &H20000000
    5.         MNS_AUTODISMISS = &H10000000
    6.         MNS_NOTIFYBYPOS = &H8000000
    7.         MNS_CHECKORBMP = &H4000000
    8.     End Enum
    9.    
    10.     Private Enum MENUINFO_MASKS
    11.         MIM_MAXHEIGHT = &H1
    12.         MIM_BACKGROUND = &H2
    13.         MIM_HELPID = &H4
    14.         MIM_MENUDATA = &H8
    15.         MIM_STYLE = &H10
    16.         MIM_APPLYTOSUBMENUS = &H80000000
    17.     End Enum
    18.    
    19.     Private Type MENUINFO
    20.         cbSize As Long
    21.         fMask As MENUINFO_MASKS
    22.         dwStyle As MENUINFO_STYLES
    23.         cyMax As Long
    24.         hbrBack As Long
    25.         dwContextHelpID As Long
    26.         dwMenuData As Long
    27.     End Type
    28.    
    29.     Private Declare Function GetMenuInfo Lib "user32" (ByVal hMenu As Long, MI As MENUINFO) As Long
    30.     Private Declare Function SetMenuInfo Lib "user32" (ByVal hMenu As Long, MI As MENUINFO) As Long
    31.     Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
    32.     Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
    33.  
    34. Private Sub Form_Load()
    35.     Dim MI As MENUINFO
    36.      
    37.     With MI
    38.       .cbSize = Len(MI)
    39.       .fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
    40.       .hbrBack = CreateSolidBrush(&HC0&)
    41.       SetMenuInfo GetMenu(Me.hwnd), MI
    42.     End With
    43.  
    44. End Sub

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    w00t thx everybody
    PS : the demo for Office style Menu did work for XP (service pack 1 installed)

  10. #10
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Really, the other person most of had a dodgee os

    Glad it worked, now my program should be supportable to XP heere. Glad you like the control dude, i know i did. It works so smooth as well, my Windows 98 finally has XP look I think ill remake every windows app to give it XP look. Only kidding, i just install Office XP.

    Nah i hate XP, takes ages to load, because of the fancy graphics, really unstable too. I like the graphics, thats about it, its just need higher spec pc's Which im screwed:

    Win98 SE
    128.0Mb Ram
    12GB Hd
    556Mhz Intel Celeron Processor

    AGHHH!

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    new question (btw if u havent figured it out yet im a noob at this)


    where in demotivator section do you define the :
    menu color ?
    Mouse over color?
    and the font color?

    I think i can tell its done by Hex colors but which lines do actually define the colors


    thx for your patience with me
    Last edited by High_Octane; Dec 10th, 2003 at 05:41 PM.

  12. #12
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    What do you mean lines? Anyway you can set it at the forms property section at design time. (if you need values i.e code for colors ask me, i have a program to give you all the color codes you need)

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    aight illtell you how i plan this to be
    I want the top menu to be Black with blue Font and demotivators code changes the color of the menu to red what im trying to figure out is where exactly in his code he changed the color to red.



    As for the smartXpmenu i will use it to help me with my Flat command buttons like forward and Back buttons

  14. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    VB Code:
    1. .hbrBack = CreateSolidBrush(&HC0&)
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    how does that make it red?

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    It creates a brush to paint the back of the menus with using the
    hex color for red of C0 or 192. think of .hbrBack as the background color property for the menu.

    Edit.
    And the .Mask property tell it to paint the sub menus also.
    VB Code:
    1. .fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    oh aight thx dude so if hrback is is the back color would hrfore change the font color ?


    i concluded this cause the Fore color changes the font color onthe form

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No. There are only the properties defined in the type.
    VB Code:
    1. Private Type MENUINFO
    2.     cbSize As Long
    3.     fMask As MENUINFO_MASKS
    4.     dwStyle As MENUINFO_STYLES
    5.     cyMax As Long
    6.     hbrBack As Long
    7.     dwContextHelpID As Long
    8.     dwMenuData As Long
    9. End Type
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  19. #19

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    allright i looked through the code and the only time hbrback is defined is in here
    Code:
    Private Type MENUINFO
        cbSize As Long
        fMask As MENUINFO_MASKS
        dwStyle As MENUINFO_STYLES
        cyMax As Long
        hbrBack As Long
        dwContextHelpID As Long
        dwMenuData As Long
    End Type
    so i tried simply defining "hbrFore AS long"

    but as soon as i do that even without trying to do the solid color brush to it , it seems to reset everything to standart colors again ( but no erros show up well besides that it wrecks the whole thing)
    again thx for you patience

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You can not add defini****ions to this type. Hold on I think I can
    find one of my old projects that use owner drawn menus.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25


    argh


    lol i do not know where i would be on this if it wasnt for you all ( likely on my way to buy a new keyboard lol )

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Your going to need allot of APIs and patience to change the text color. I will post the APIs as I find them. Too much code to go
    through in my project.
    VB Code:
    1. Option Explicit
    2.  
    3. Dim m_hDC As Long
    4. Dim hMenu As Long
    5. Dim hSubMenu As Long
    6. Dim mnuID As Long
    7.  
    8. Private Type POINTAPI
    9.     x As Long
    10.     y As Long
    11. End Type
    12.  
    13. Private Type RECT
    14.     Left As Long
    15.     Top As Long
    16.     Right As Long
    17.     Bottom As Long
    18. End Type
    19.  
    20. Public Declare Function CreateSolidBrush Lib "GDI32" (ByVal crColor As Long) As Long
    21.  
    22. Public Declare Function SelectObject Lib "GDI32" (ByVal hdc As Long, ByVal hObject As Long) As Long
    23.  
    24. Public Declare Function DeleteObject Lib "GDI32" (ByVal hObject As Long) As Integer
    25.  
    26. Public Declare Function GetSysColor Lib "user32" (ByVal nIndex As ColConst) As Long
    27.  
    28. 'Color constants for GetSysColor
    29. Public Enum ColConst
    30.     COLOR_ACTIVEBORDER = 10
    31.     COLOR_ACTIVECAPTION = 2
    32.     COLOR_ADJ_MAX = 100
    33.     COLOR_ADJ_MIN = -100
    34.     COLOR_APPWORKSPACE = 12
    35.     COLOR_BACKGROUND = 1
    36.     COLOR_BTNFACE = 15
    37.     COLOR_BTNHIGHLIGHT = 20
    38.     COLOR_BTNSHADOW = 16
    39.     COLOR_BTNTEXT = 18
    40.     COLOR_CAPTIONTEXT = 9
    41.     COLOR_GRAYTEXT = 17
    42.     COLOR_HIGHLIGHT = 13
    43.     COLOR_HIGHLIGHTTEXT = 14
    44.     COLOR_INACTIVEBORDER = 11
    45.     COLOR_INACTIVECAPTION = 3
    46.     COLOR_INACTIVECAPTIONTEXT = 19
    47.     COLOR_MENU = 4
    48.     COLOR_MENUTEXT = 7
    49.     COLOR_SCROLLBAR = 0
    50.     COLOR_WINDOW = 5
    51.     COLOR_WINDOWFRAME = 6
    52.     COLOR_WINDOWTEXT = 8
    53. End Enum
    54.  
    55. Public Declare Function GetTextColor Lib "GDI32" (ByVal hdc As Long) As Long
    56.  
    57. Public Declare Function SetTextColor Lib "GDI32" (ByVal hdc As Long, ByVal crColor As Long) As Long
    58.  
    59. Public Declare Function TextOut Lib "GDI32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _
    60. ByVal lpString As String, ByVal nCount As Long) As Long
    61.  
    62. Public Declare Function SetBkMode Lib "GDI32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
    63.  
    64. Public Const NEWTRANSPARENT = 3 'use with SetBkMode()
    65.  
    66. Public Declare Function CreatePen Lib "GDI32" (ByVal nPenStyle As Long, ByVal nWidth As Long, _
    67. ByVal crColor As Long) As Long
    68.  
    69. Public Declare Function MoveToEx Lib "GDI32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _
    70. lpPoint As POINTAPI) As Long
    71.  
    72. Public Declare Function LineTo Lib "GDI32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
    73.  
    74. Public Declare Function Rectangle Lib "GDI32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, _
    75. ByVal X2 As Long, ByVal Y2 As Long) As Long
    76.  
    77. Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    78. (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    79.  
    80. Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
    81. ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    82.  
    83. Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
    84. (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    85.  
    86. Public Const GWL_WNDPROC = (-4)
    87. 'Messages to use in the wndproc
    88. Public Const WM_DRAWITEM = &H2B
    89. Public Const WM_MEASUREITEM = &H2C
    90. Public Const WM_MENUSELECT = &H11F
    91. Public Const WM_COMMAND = &H111
    92. Public Const WM_GETFONT = &H31
    93.  
    94. Public Type MENUITEMINFO
    95.     cbSize As Long
    96.     fMask As Long
    97.     fType As Long
    98.     fState As Long
    99.     wID As Long
    100.     hSubMenu As Long
    101.     hbmpChecked As Long
    102.     hbmpUnchecked As Long
    103.     dwItemData As Long
    104.     dwTypeData As Long
    105.     cch As Long
    106. End Type
    107.  
    108. Public Const MIIM_TYPE = &H10
    109.  
    110. Public Type MEASUREITEMSTRUCT
    111.     CtlType As Long
    112.     CtlID As Long
    113.     itemID As Long
    114.     itemWidth As Long
    115.     itemHeight As Long
    116.     ItemData As Long
    117. End Type
    118.  
    119. Public Type DRAWITEMSTRUCT
    120.     CtlType As Long
    121.     CtlID As Long
    122.     itemID As Long
    123.     itemAction As Long
    124.     itemState As Long
    125.     hwndItem As Long
    126.     hdc As Long
    127.     rcItem As RECT
    128.     ItemData As Long
    129. End Type
    130.  
    131. Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
    132.  
    133. Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
    134.  
    135. Public Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
    136.  
    137. Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, _
    138. ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Long) As Long
    139.  
    140. Public Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal uItem As Long, _
    141. ByVal ByPosition As Long, lpMenuItemInfo As MENUITEMINFO) As Boolean
    142.  
    143. Public Const MF_BYCOMMAND = &H0
    144. Public Const MF_BYPOSITION = &H400
    145. Public Const MF_OWNERDRAW = &H100
    146. Public Const MF_SEPARATOR = &H800
    147. Public Const MFT_SEPARATOR = MF_SEPARATOR
    148. Public Const ODS_SELECTED = &H1
    149.  
    150. Public Sub DrawRect(ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long)
    151.     If m_hDC = 0 Then Exit Sub
    152.     Call Rectangle(m_hDC, X1, Y1, X2, Y2)
    153. End Sub
    154.  
    155. Public Function GetPen(ByVal nWidth As Long, ByVal Clr As Long) As Long
    156.     GetPen = CreatePen(0, nWidth, Clr)
    157. End Function
    158.  
    159. Public Function hPrint(ByVal x As Long, ByVal y As Long, ByVal hStr As String, ByVal Clr As Long) As Long
    160.  
    161.     If m_hDC = 0 Then Exit Function
    162.     'Equivalent to setting a form's property
    163.     'FontTransparent = True
    164.     SetBkMode m_hDC, NEWTRANSPARENT
    165.    
    166.     Dim OT As Long
    167.     OT = GetTextColor(m_hDC)
    168.     SetTextColor m_hDC, Clr
    169.     'Print the text
    170.     hPrint = TextOut(m_hDC, x, y, hStr, Len(hStr))
    171.     'Restore old text color
    172.     SetTextColor m_hDC, OT
    173.    
    174. End Function
    175.    
    176. Public Property Get TargethDC() As Long
    177.     TargethDC = m_hDC
    178. End Property
    179.  
    180. Public Property Let TargethDC(ByVal vNewValue As Long)
    181.  
    182.     'The hDC to draw to when performing operations
    183.     'from this module's subroutines.
    184.     m_hDC = vNewValue
    185.    
    186. End Property
    187.  
    188. Public Sub OwnerDrawMenu(ByVal ItemData As Long)
    189. 'Change the menu's style to owner-draw. You must
    190. 'now subclass the form that this menu is on so
    191. 'you can respond to the WM_MEASUREITEM and WM_DRAWITEM
    192. 'messages.
    193.  
    194.     Dim mii As MENUITEMINFO
    195.    
    196.     mii.cbSize = Len(mii)
    197.     mii.fMask = MIIM_TYPE
    198.     GetMenuItemInfo hSubMenu, MenuID, False, mii
    199.    
    200.     If ((mii.fType And MF_SEPARATOR) = MF_SEPARATOR) Then
    201.         '*Preserve* separator style...
    202.         Call ModifyMenu(hSubMenu, MenuID, _
    203.         MF_BYCOMMAND Or MF_OWNERDRAW Or MF_SEPARATOR, _
    204.         MenuID, ItemData)
    205.     Else
    206.         Call ModifyMenu(hSubMenu, MenuID, _
    207.         MF_BYCOMMAND Or MF_OWNERDRAW, MenuID, ItemData)
    208.     End If
    209.    
    210. End Sub
    211.    
    212. Public Function OwnMenuProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    213.     OwnMenuProc = m_Form.MsgProc(hwnd, wMsg, wParam, lParam)
    214. End Function
    215.  
    216. Public Sub SetTopMenu(NewMnu As Long)
    217.     hMenu = NewMnu
    218. End Sub
    219.  
    220. Public Property Get SubMenu() As Long
    221.     SubMenu = hSubMenu
    222. End Property
    223.  
    224. Public Property Let SubMenu(ByVal vNewValue As Long)
    225.     hSubMenu = GetSubMenu(hMenu, vNewValue)
    226. End Property
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    WOW thx dude ill be going throuhg this tonight
    but me old LAdy is itching to go out so i gotta go thx a bunch for your help though and ill be checkign back later on tongight

    HAve fun
    and thx again ALL

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No problem. There is still about another posting like that of code
    to complete this. It is hell to subclass owner drawn menus, but if
    done right they are worth it. This code is from a project I have
    that I did MS Office 2000 menus.

    I have to get ready to go home, so I will post the rest tomorrow morning.

    Enjoy your night out.
    I know what you mean. My wife has similar needs to
    go out.
    Later.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  25. #25

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    Well im back for the day U around today Rob?

  26. #26
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Ya, I'm here. Been working on a demo project for you and got busy at work. It was too much to try to filter out the code.

    Question, are you going to show the selected background on the
    menu or no selection at all? Your main issue is to set the back
    color and fore color right? How about images in the menus?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  27. #27

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    correct the back color can allready be set with the help demotivaters code section

    im not in great need of images in the menu though
    Last edited by High_Octane; Dec 11th, 2003 at 03:52 PM.

  28. #28

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    im also playing around with that office Xp menu thingy and seems that i can do just about everything with it that i want only one thing i havent figured out yet can i add a menu Item during run time ? i need this for a favorites list



    i greatly appreciate all your guys help but if u havent started on that demo project for me yet Rob the XP office menu seems to be able to do everything i need (all the options i could possibly want) you should check it out

  29. #29
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I had looked at it a while ago and it was crashing my project so I
    haven't really been using it. Does it let you change the font color?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  30. #30

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    25
    yeah Font Colors for Text then Text selected and so forth what it actualy does is create a new controll that has pretty much nothing ( as far as i can see) to do with the original Menu editor
    You add evrything and set evrything in code just dowload and register those two files with your registry and check out the demo project its all very simple


    plus the Help seciton they have on their web site is Very informative abotu how all this works

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