hi,
i want to list out the sub-menu items from file menu of active application(foreground window) .
Is it possible to list out the sub-menu by program?
thanks in advance,
-Mahendran
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jean PaulPosted Nov 11, 2011, 5:33 AM
To achieve this, use the form reference to iterate over the Controls property. Find the control which is of MenuStrip type. ( I hope you are using MenStrip in winforms)
After getting the MenuStrip object you can use the Items property which are the top level menu items like File, Edit etc. Get the File item by searching using the text. Once you get the File item, cast it to ToolStripMenuItem and use the DropDown.Items property to get all sub menus.