Results 1 to 15 of 15

Thread: [RESOLVED] menu editor from right to left

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] menu editor from right to left

    hey

    i created a popup menu in my form
    is there a way when i right click it will show me the text from right to left?
    now it shows from left right by defualt

    tnx for the help

  2. #2

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,263

    Re: menu editor from right to left

    ... or you just have to search for the correct words.


    Look at Post #3
    http://forums.codeguru.com/showthrea...u-to-the-right
    Code:
    private Declare Function GetMenu Lib "user32" (byval hwnd as Long) as Long
    private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA"  (byval hMenu as Long, byval nPosition as Long, byval wFlags as Long,  byval wIDNewItem as Long, byval lpString as Any) as Long
    private Const MF_BYPOSITION as Long = &H400&
    private Const MF_STRING as Long = &H0&
    private Const MF_RIGHTJUSTIFY as Long = &H4000
    
    private Sub Form_Load()
        Dim hMenu as Long
        
        hMenu = GetMenu(me.hwnd)
        ' the second parameter in this example is the menu position...
        'the first menu is at 0
        Call ModifyMenu(hMenu, 3, MF_BYPOSITION Or MF_RIGHTJUSTIFY, MF_STRING, "&Help")
        
    End Sub
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  4. #4

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: menu editor from right to left

    Quote Originally Posted by RhinoBull View Post
    If you mean you want text to appear right aligned then probably NO.
    You may instead design your own form and show it on right click instead.
    exactly

  5. #5

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: menu editor from right to left

    it dont work

    beacuse i made the rightclick not visible in the form

    with a popup menu


    Code:
    Private Sub Form_Load()
     Dim hMenu As Long
        
        hMenu = GetMenu(Me.mnuRightClick)
        ' the second parameter in this example is the menu position...
        'the first menu is at 0
        Call ModifyMenu(hMenu, 3, MF_BYPOSITION Or MF_RIGHTJUSTIFY, MF_STRING, "&Help")

  6. #6

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: menu editor from right to left

    rhino do you have skype ?

    beacuse i cant send you message here
    i need to ask you something

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,263

    Re: menu editor from right to left

    Your error is the GetMenu-Line. You have to leave that one as it is in the sample.

    I've marked something red in the code. This is where you have to select which menu to change with 0 being the first menu in the menubar (The "3" was just an example)


    Code:
    private Declare Function GetMenu Lib "user32" (byval hwnd as Long) as Long
    private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA"  (byval hMenu as Long, byval nPosition as Long, byval wFlags as Long,  byval wIDNewItem as Long, byval lpString as Any) as Long
    private Const MF_BYPOSITION as Long = &H400&
    private Const MF_STRING as Long = &H0&
    private Const MF_RIGHTJUSTIFY as Long = &H4000
    
    private Sub Form_Load()
        Dim hMenu as Long
        
        hMenu = GetMenu(me.hwnd)
        ' the second parameter in this example is the menu position...
        'the first menu is at 0
        Call ModifyMenu(hMenu, 3, MF_BYPOSITION Or MF_RIGHTJUSTIFY, MF_STRING, "&Help")
        
    End Sub
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  8. #8

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: menu editor from right to left

    what is the 3 mean?

  9. #9
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,263

    Re: menu editor from right to left

    It's the position of the menu with 0 being the first, like in this example:
    0 - File
    1 - Edit
    2 - View
    3 - Extras
    4 - Help
    and so on.....
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  10. #10

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: menu editor from right to left

    do i put this in a module?

    Code:
    private Declare Function GetMenu Lib "user32" (byval hwnd as Long) as Long
    private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA"  (byval hMenu as Long, byval nPosition as Long, byval wFlags as Long,  byval wIDNewItem as Long, byval lpString as Any) as Long
    private Const MF_BYPOSITION as Long = &H400&
    private Const MF_STRING as Long = &H0&
    private Const MF_RIGHTJUSTIFY as Long = &H4000

  11. #11
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,263

    Re: menu editor from right to left

    Yes, but instead of "private" declare it "public"
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  12. #12

  13. #13

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: menu editor from right to left

    tnx for the help guys

  14. #14
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,263

    Re: [RESOLVED] menu editor from right to left

    So the code i found worked?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  15. #15

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: [RESOLVED] menu editor from right to left

    nope but tnx for the help

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