Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use system calculator in my wpf form using System.Diagnostics.Process.Start("calc"); but now I want to store result of calculation in my wpf apps textbox.

Please tell me how to store this result.
Updated 15-May-13 4:24am
CrystalB 15-May-13 10:36am    
It is stand alone exe. It is not possible to get the result . It is better to create your own calc
Sergey Alexandrovich Kryukov 15-May-13 10:59am    
Despite of Solution 1, it's a good point. Possible or not, this is quite a bad idea.

1 solution

CrystalB is not quite right - it is possible to get the result from Calc - it uses standard controls so as long as the user hasn't closed it, it is possible if you follow the window handles and locate it's control ID. But...I've never done it, partly because it's a PITA from C# and partly because it is a nasty and rather stupid thing to do.

Instead, I would look at the various calculator apps available (and there are loads: Codeproject calculators[^]) and adapt one of those to work within your application and return results when you want them to. It'd probably be easier, and certainly would be safer, given that Calc.exe is subject to change at the whim of Microsoft.
Share this answer
Sergey Alexandrovich Kryukov 15-May-13 10:59am    
Agree, a 5.

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