Results 1 to 2 of 2

Thread: Appendmenu description string garbled

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    australia
    Posts
    8

    Appendmenu description string garbled

    I am trying to use Appendmenu to dynamically add sub menus.
    I am playing with the code and can't get the menu description to display. It is just garbled ascii as if i was using a bad pointer.

    Here is the code, i am referencing win32.tlb so the i haven't declared these functions in my code.
    Any ideas?

    Dim wHandle As Long
    Dim hmenupopup As Long
    Dim result As Long
    Dim subPop As Long

    wHandle = GetMenu(Me.hwnd)
    hmenupopup = CreatePopupMenu()
    subPop = CreatePopupMenu()

    result = AppendMenu(subPop, MF_STRING, 10, "Sub1")
    result = AppendMenu(hmenupopup, MF_POPUP, subPop, "Sub")

    result = AppendMenu(hmenupopup, MF_STRING, 1, "Copy")
    result = AppendMenu(hmenupopup, MF_STRING, 2, "Cut")
    result = AppendMenu(wHandle, MF_POPUP, hmenupopup, "Edit")

    DrawMenuBar (Me.hwnd)

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    I used the tlb's that came with Hardcore VB, and it worked fine, it sounds daft and should be noddifferent than the way you are currently doing but maybe you could try:
    Code:
    Dim wHandle As Long 
    Dim hmenupopup As Long 
    Dim result As Long 
    Dim subPop As Long 
    Dim smItem As String
    smItem = "Sub1" & VbNullChar
    wHandle = GetMenu(Me.hwnd) 
    hmenupopup = CreatePopupMenu() 
    subPop = CreatePopupMenu() 
    'dunno if this will change anything - but worth a try...
    result = AppendMenu(subPop, MF_STRING, 10, ByVal smItem)
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

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