I am working with Add-Ins in ArcMap using VS2010 and C#. I have a question in regards to ArcObjects ICommandBar and ICommandItem classes. I've looked at these and have been able to produce code, that on button click, will select or activate a specified command item. So I know somethings about command bars. My question is how would I go about determining which command Item is active on a Command Bar? I didn't see any helpful mehtods in which to do so. Any help on this would be greatly appreciated.
UID thisID = new UID();
thisID.Value = "esriArcMapUI.SelectTool";
IDocument ThisDoc = ArcMap.Application.Document;
ICommandBars CommandBars = ThisDoc.CommandBars as ICommandBars;
CommandBars.Find(thisID);
ICommandItem myItem = CommandBars.Find(thisID) as ICommandItem;
if (myItem.Execute() == true)
{
messagebox.show("My select element tool is selected");
}