使用WIN32 API打印文件 [英] Printing files using WIN32 API

查看:276
本文介绍了使用WIN32 API打印文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将我的SPFolder中找到的文件直接打印到打印机而不识别文件类型,以便调用哪个Windows API以及如何调用它?当有多个文件同时打印时,启动打印作业的过程是什么?

I need to print my Files found in my SPFolder directly to the Printer without recognizing the file type, so which Windows API to call and how to call it ? Also what's the process to launch the printing job when there are many files to print at the same time ?

推荐答案

如果使用C#,直接使用Win32 API打印将是1)笨拙,难以实现,2)不是平台可移植的(与使用 CLI 和.NET FCL - 您可以在非编号上运行代码微软平台)。 我认为没有任何可以获得任何好处的情况。由于大多数成员也不喜欢把时间花在没有意义或没有用的东西上,你需要提供一个< b>令人信服的动机你想要什么,但我认为你不能成功。



-SA
If you use C#, printing directly with Win32 API would be 1) awkward, hard to implement, 2) not platform-portable (in contrast to using CLI and .NET FCL — you would be able to run your code on a number non-Microsoft platforms). I see no situations where you can get any benefits of it. As most members also don't like waste their time on something which does not make sense or not really useful, you will need to provide a convincing motivation of what you want, but I don't think you can succeed.

—SA


您好,



您可以使用假脱机程序API。本文可以帮助您:



http://支持.microsoft.com / kb / 322091 / zh-CN [ ^ ]

http://support.microsoft.com/ kb / 138594 / zh-CN [ ^ ]



问候,

Maxim。
Hello,

You can use spooler API. This articles helps you:

http://support.microsoft.com/kb/322091/en-us[^]
http://support.microsoft.com/kb/138594/en-us[^]

Regards,
Maxim.


这就是你要找的东西:



This is what you're looking for:

var processStartInfo = new ProcessStartInfo(filename)
{
    Verb = "Print",
    CreateNoWindow = true,
    WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(processStartInfo);


这篇关于使用WIN32 API打印文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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