打开任何类型的文件,以编程方式单击“打印"按钮. [英] Open any type of file,click print button programatically.

查看:92
本文介绍了打开任何类型的文件,以编程方式单击“打印"按钮.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows应用程序IAM中,使用System.Diagnostics.Process.Start(filepath)打开文件,然后我将以编程方式单击打印选项.
我们是否能够在Windows应用程序中实现这一目标.

In windows application iam using System.Diagnostics.Process.Start(filepath) to open the file and i would to click the print option thro programatically.
whether we can able to achieve this in windows application. Kindly help me.

推荐答案

如果这是子进程中的按钮,则只能使用P/Invoked Windows API模拟使用输入,例如鼠标单击SendInput: http://msdn.microsoft.com /en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx [ http://pinvoke.net/default.aspx/user32.sendinput [
If this is a button in a child process, you can only simulate a use input like a mouse click, using P/Invoked Windows API SendInput: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^], http://pinvoke.net/default.aspx/user32.sendinput[^]. Remember, the processes are well isolated. You cannot effectively control a foreign process unless it is specially designed for accessibility from another process.

Look, if I understand you right and you want to control a child process, let me tell you: you are solving a bad problem. This is pretty much useless and hardly can be reliable. This will not integrate a process in your application.

—SA


这篇关于打开任何类型的文件,以编程方式单击“打印"按钮.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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