Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to create a windows application in c# which open the windows calculator and also i close that calculator using the same win.application.finaly i want to read the content of windows calc text box and paste that in text box present in my application when i use close button in my win application.

so far i use the below code in button click event to open and close the windows calc but i am unable to read the text of windows calci text box

my code:
Collapse | Copy Code

C#
private void button1_Click(object sender, EventArgs e)
{
    p = Process.Start("calc");
}

private void button2_Click(object sender, EventArgs e)
{
    p.Kill();
}



this will open and close the windows calc.please help meee...

Thanks in advance....
Posted
Comments
Jephunneh Malazarte 8-Sep-11 4:19am    
just curious... why do you want to read the content in win calc textbox?

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[^]
 
Share this answer
 
Comments
DanHodgson88 8-Sep-11 4:24am    
nice answer 5*
Simon Bang Terkildsen 8-Sep-11 9:37am    
Thank you, Dan
Mehdi Gholam 8-Sep-11 6:19am    
Nice, 5!
Simon Bang Terkildsen 8-Sep-11 9:37am    
Thank you, Mehdi
My solution is to make a calculator yoursef. It is alot simplier than trying to use the win calculator and take its value, make your own then you know you can just pull the value you and use it for whatever you want!
 
Share this answer
 
Comments
Simon Bang Terkildsen 8-Sep-11 9:38am    
Agreed and I'm sure someone has actually made a calculator already, ready to be consumed
+5
Use Window Hook to read text from calculator.
 
Share this answer
 
Design user control


Button after <pre lang="text"></pre>

Button click event:

cl=Process.Start("calc");


thanks
Raja
 
Share this answer
 
Comments
Simon Bang Terkildsen 8-Sep-11 9:39am    
Is this an answer to the OP's question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900