Menu

Standard way of adding a menu?

GVC
2007-09-01
2012-11-14
  • GVC

    GVC - 2007-09-01

    Hi,

    Is there a standard way of adding a menu to the already existing NotePad++ menu bar?  Is it possible to add this extra menu item dynamically?
    If so, where is this written down?

    Best rgds,

    --Geert

     
    • Salocin Delbab

      Salocin Delbab - 2007-09-02

      coucou Geert,

      I suppose thqt Chris Severance (severach at users.sourceforge.net) can explain it very well as he uses that capacity of NPP for the TextFx PlugIn. you can see his code (http://textfx.no-ip.com/textfx/NPPTextFX23-v0.23ReleaseSource.zip) ... Enjoye, and see you tomorrow.

      Nico

       
      • GVC

        GVC - 2007-10-12

        Bonjour, monsieur Salocin treize...

        Yep, I did contact Chris and verified his code, but what harrybharry said in his reply was in fact the clue key: Just use GetMenu(), so you get the pointer to the NPP menu and then you can traverse the menu (had a look to the code of Chris for that) until you find the menu item after which you want to add your menu item.

        Works fine, but I still have to figure out how to remove the name of my plugin from the Plugins menu section.

        What I did was returning NULL for the GetName() function, but then I get a kind of separator in the Plugins menu.

        So, now I have my "own" menu in the menu bar, but next to this I have the separator in the Plugins menu, which I want to get rid of.

        Maybe someone does know how to avoid to add my plug-in to the list of plug-ins in the Plugins menu?  Don Ho maybe?

        Best rgds,

        --Geert

         
        • Don HO

          Don HO - 2007-10-13

          The only way (for me) to do what you want is (even though it's not recommanded) :

          1. Keep using the plugin interface normally (don't return NULL for GetName() function.)
          2. Use GetMenu() to have menu handle .
          3. Add your new menu entry and remove the old menu entry by using the menu handle you've got.

          Don

           
          • GVC

            GVC - 2007-10-25

            Ok, will try this.

            Question: why do you say it's not recommended?  Any particular reason?

            Best rgds,

            --Geert

             
    • Harry

      Harry - 2007-09-03

      I think you can use HMENU GetMenu(HWND nppData._nppHandle) to retrieve the menu, then change it to your likings

       
MongoDB Logo MongoDB