如何在运行时更改打印机设置。 [英] How to change printer settings during runtime.

查看:86
本文介绍了如何在运行时更改打印机设置。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

我正在使用以下代码在运行时更改打印机设置。

I'm using following codes to change printer setting during runtime.

但是当我编译程序并为程序构建EXE文件它不会更改设置并显示此消息...

But when I compile program and build EXE file for program It doesn't change the setting and shows this message ...

我想要c在内部更改打印机设置,而不是反复通过打印对话框

I want to change printer setting internally, not through print dialog box repeatedly

在将来更改打印机时更有用,任何解决方案都可以执行此操作...

It is more useful when I change Printer in future as well, Any solution to do this ...

问候

ShahidSQL(印度)

ShahidSQL (India)

推荐答案

嗨ShahidSQL,

Hi ShahidSQL,

VFP中的报表文件是一个表,因此您必须像使用免费表一样使用它。

a report file in VFP is a table, therefore you have to USE it like a free table.

USE "c:\myApp\myReports\myReportfile.frx" IN 0

现在你有一个光标可以保存完整的报告数据。

Now you have a cursor that holds the complete report data.

你必须找到正确的记录并修改正确的记录列然后关闭'table'并启动报告。

You have to locate the correct record and modify the correct column and afterwards close the 'table' and start the report.

现在你的方式为时已晚,因为报告运行时已打开frx(在只读模式下)因此不能改变你想要的方式。

The way you are doing it now is too late, as the report runtime has opened the frx (in read only mode) and therefore cannot be changed the way you want to do it.

恕我直言,你应该为此选择另一种方法。

IMHO, you should select another approach for this.

保留原始报告,不要改变它!

Leave the original report alone, don't change it!

你所要做的就是将frx / frt文件复制到一个临时文件名( - >原始文件名+ SYS(2015)+。frt /。 FRX)。打开新的frx作为表,进行更改,关闭表,启动此报告并在报告
完成后删除临时frx / frt文件。

All you have to do is to copy the frx/frt files to a temporary filename (-> original filename+SYS(2015)+.frt/.frx). Open the new frx as table, make your changes, close the table, start this report and delete the temp frx/frt files after the report is finished.

但是.. ....

这是我不会尝试的尝试。我们的应用程序使用~60种不同的报告,可在UNIX,VFP和CR中使用。每个基础报告都有n个变量(针对我们客户的客户的个性化设计),每个变体都有n个输出(PDF,PDF邮件,
传真,JSON,XML,JPEG,预览,默认打印机,打印机选择等)。 )。如果我必须通过更改frx在运行时更改所有这些单独的设置,那么VFP将不再出现在我的硬盘上;))

this is an attempt I wouldn't use. Our application uses ~60 different reports that are availlable in UNIX, VFP and CR. Each base report has n-variations (individual designs for customers of our customers) and each variation has n outputs (PDF, PDF mail, fax, JSON, XML, JPEG, Preview, default printer, printer select, etc.). If I'd have to change all those indiviual settings during runtime by changing the frx, then VFP wouldn't be on my hard drive anymore ;))

所以最后,我建议您可以考虑这一点并尝试构建您的需求,然后创建一个用户可以使用的管理工具。

so in the end, I advise you to think this over and try to structure your needs and then to create an admin tool that your users can work with.

JM2C

编辑:

另外一个想法......在多用户环境中,这还取决于您的应用的安装方式。处理用户PC和/或终端服务器和/或文件服务器上的安装,其中每个用户可能具有单独安装的打印机,没有本地电子邮件客户端
或传真也将这也带到更高级别。你将不得不考虑比你想象的更多的个人主义和问题;)

one additional thought... In a multiuser environment this also depends on how your app is installed. Handling installations on user PC and/or a terminal server and/or a fileserver where every user may have individual installed printers, no local email client or fax will take this also to a higher level. And you will have to consider many more individualisms and problems than you've ever thought of ;)


这篇关于如何在运行时更改打印机设置。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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