Results 1 to 12 of 12

Thread: Menus and visibility...

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Menus and visibility...

    How is it that menus are made visible/invisible in C++? Do you just use RemoveMenu/InsertMenu, and keep track of the menu's position when its removed, or is there an easier way?

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I remember from a long time ago when I wrote my own dynamic menu in VB using the API that it had some flags like visible etc.
    But I'm not really sure
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Thanks, I'm using this for VB, as a matter of fact. I'll take another look through the docs then.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Nope, it would appear not.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Okay, I've got jim mcnamara over at galahtech, and he said that I can use SetWindowLong to add/remove the WS_VISIBLE property once I have the hWnd of the menu. So, anyone know how to get that?

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Oh now, don't be shy...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    One last bump...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  8. #8
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Hi, I'm in a hurry now, so I can't go into detail, but the use of SetWindowLong is relativly simple.

    You should get the style of the menu first (with GetWindowLong), then modify the result of GetWindowLong, and set the modified style with SetWindowLong

    It has to be something like this:
    Code:
    DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
    dwStyle = dwStyle | WS_VISIBLE; //Not sure if it should be | or & , I'm too tired :) but I think this is the right way...
    SetWindowLong(hWnd, GWL_STYLE , dwStyle);
    Something like that... If you need more help I can probably help you tomorrow
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  9. #9

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Yeah, it wasn't the actual changing of the style that was bugging me, it was how to get the hWnd of a menu. Everything else I have a pretty good grip on.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  10. #10
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I've been looking for you but I couldn't find any info on how to hide a menu-item (only with MFC), maybe just try passing the HMENU handle of the menu-item (Use GetMenu and then GetSubMenu to get it), but I think it won't work.. If I have time I'll try to find out for ya
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  11. #11

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I gave the HMENU handle a shot, just out of desperation, and it had no effect.

    It would be great if you could find something. I've been sifting through MSDN and google and have found nothing. I don't mind just using RemoveMenu to "hide" it and just keep track of what position the menu had, but if there is a better way, I'd rather go with that.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  12. #12
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Yeah I've been looking for an hour or so... I still think there must be some way though... well removing and readding is possible of course, maybe that's how the VB & MFC function do it?

    I'll keep you updated if I find something, made me curious
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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