C++ Buttons Identifier

I'm looking for a library that will be able to do something like pointer scan to find all the buttons being displayed on a website or program. For example, when you want to close a program it says Save, No, and Cancel. I would like to be able to recognize these three buttons and be able to say:

If(Button == "Save")