That's not a simple task you'll have to either use UIAutomation or the win32 API.
Providing you code that does what you want is simply to big for me to be willing to spend time writing for you.
But I found this article for you which shows not only how to use UIAutomation but uses thw windows calculator as an example. All the info you'll ever need on the subject is right there:
Automate your UI using Microsoft Automation Framework[
^]