Well can we retrieve On or OFF state of toggle button. Do we have any property of toggle button that can be read from toggle button that is ON or OFF?
Unfortunately there is not way to detect the current state of a togglebutton. However if you create a matching menu item you can read the state of this and sop determine the state of the button.
That would of course also require that you in the handler for the button toggle the menu item as well as the button. You could create a standard menu handler and a standard togglebutton handler that just picks up the ID of the menu item/button and then calls a shared procedure that does the real work.
Use CommandInfo() to figure out which menu item/button was pressed. And use MenuItemInfoByID() to determine the current state of the menu item (and so the button)
Another solution would be to have a variable in your application that you can test to see whether the state of the button is checked or unchecked.