none
word 2013 crashes when window method ToggleRibbon() is called with backstage open. RRS feed

  • Question

  • In a com application for word 2013, I had attached a call-back function using SetWindowsHookEx function to monitor keyboard events.
    Snippets of the call-back function :

    if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
           {
               //....
                MSWord.Window w = Globals.ThisAddIn.Application.ActiveWindow;            w.ToggleRibbon(); //crashes here
                w.ToggleRibbon();
               //...
          }

    When this method is called with backstage open, word crashes. Although, it works fine with word 2010.

    My main aim is to close the backstage, and I was relying on ToggleRibbon() method for this as a hack. Is there any other possible way to achieve this.

    Monday, April 1, 2013 8:30 AM

All replies

  • If I need to do this, I use SendKeys to send the ESC key press...

    Cindy Meister, VSTO/Word MVP, my blog

    Monday, April 1, 2013 3:53 PM
    Moderator
  • Any solutions for this bug? try catch doesn't seem to catch the exception for some reason.

    Roman Alifanov(1989)- MCTS-MCAD-MCP-MCT - IT Hero - www.animaonline.blogspot.com

    Tuesday, April 1, 2014 9:54 AM