简体   繁体   中英

How can I determine if my VSTO ribbon is active in Word

I have a VSTO project that creates a ribbon tab in Word.

In this Stackoverflow link I can see how to force my ribbon tab to be activated.

No where can I find how to perform sort-of the reverse - ie I want to know whether my ribbon tab is active or not.

Can anyone tell me how to achieve this? How to determine whether the ribbon tab that I can activate is still active at any other stage of the user interaction with Word?

There is no way to do that using the Outlook Object Model. As a possible workaround you can use the Microsoft Active Accessibility .

The Fluent UI (aka Ribbon UI) doesn't provide anything for that. But you can use the GetVisibleMso method of the CommandBars class for checking whether a built-in controls is visible or not. You just need to pass the idMso value of the control to the method, see Office 2013 Help Files: Office Fluent User Interface Control Identifiers . But the best way to get the job done is to use callbacks in your custom UI markup. For example, the getVisible callback is invoked when controls are going to be shown on the ribbon (your tab is active). Thus, you will always know your tab is visible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM