MenuItem occuring multiple times ....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajeetg
    New Member
    • Mar 2008
    • 2

    MenuItem occuring multiple times ....

    I am adding a menu item by Shell extension in windows mobile.
    The extension is for Menu in Context Card summary.

    I add two menu items. One MenuItem is seperator and another is with a Command ID.
    The seperator menu item just keeps adding every time the menu is rendered.

    Any idea why is it happening ?

    Code :

    STDMETHODCALLTY PE MenuExtension:: QueryContextMen u(
    __in HMENU menuHandle,
    __in UINT indexMenu,
    __in UINT commandIdFirst,
    __in UINT commandIdLast,
    __in UINT flags
    ){
    ..
    ..
    result = InsertMenuItem( menuHandle,
    indexMenu,
    commandIdFirst,
    L"Extension" );

    result = ::InsertMenu(me nuHandle, 0 ,
    MF_GRAYED | MF_BYPOSITION,
    commandIdFirst, L"Extension" );

    }
  • markmcgookin
    Recognized Expert Contributor
    • Dec 2006
    • 648

    #2
    Is this sitting in a loop? ... if you run this code more than once, are you clearing your menu items in between running it if you are not disposing of the form in between calls?

    If you put a breakpoint on your adding calls, then run the app in debug mode, you sill be able to step through the code and find out what is causing it to be run multiple times.

    Is this whole applicaiton written in unsafe code? Can you not find a simpler way to add the menu items than using the shell extension?

    Comment

    Working...