Windows计算器应用 [英] windows calculator application

查看:99
本文介绍了Windows计算器应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C#中创建一个Windows应用程序,该应用程序将打开Windows计算器,并且我也使用相同的win.application.finaly关闭该计算器,最后我想读取Windows calc文本框的内容并将其粘贴到当前的文本框中当我在Win应用程序中使用关闭按钮时,我的应用程序就会显示.

到目前为止,我在按钮单击事件中使用以下代码来打开和关闭Windows Calc,但是我无法读取Windows Calci文本框的文本

我的代码:
收合|复制代码

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

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

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




这将打开和关闭窗口calc.please meee ...

在此先感谢....




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

Thanks in advance....

推荐答案

要使用UIAutomation或win32 API,这不是一个简单的任务.

为您提供满足您需求的代码对我来说很重要,它愿意花时间为您编写代码.
但是我为您找到了这篇文章,它不仅显示了如何使用UIAutomation,还以Windows计算器为例.您在该主题上所需的所有信息都在这里:
使用Microsoft Automation Framework自动化UI [
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[^]


我的解决方案是使计算器自成一体.这比尝试使用获胜计算器并获取其值,创建自己的值要简单得多,然后您就知道可以将所需的值用于任何您想要的值!
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!


使用窗口可以从计算器读取文字.
Use Window Hook to read text from calculator.


这篇关于Windows计算器应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆