Print document control three
1. Modify the name of the print document
* - Description: When we need to print in a program written in VFP, there will be a print queue in Windows System Print Manager.
* And display the name of the document: Visual FoxPro, then the following features can help us achieve modifications
* - Set the print change resource file
SET LIBRARY to Chgname.FLL
* - Get the current default printer name
PrtName = set ("printer", 2)
* - Modify the document name
ChgprtName (PrtName, "Visual FoxPro", "My Print Document")
* - Use the syntax:
* Chgprtname (Cprintername, ColdprintedDocumentName, CNewprintedDocumentname)
* - Return:
* 0 Successful modification
* -1 No printer name given
* -2 Internal error occurred in the document in the queue
* Note: If there is no document in the print queue, return 0
* -3 Internal error occurs when modifying the print document
* -5 does not have enough memory
other instructions:
You can use the function aprinters () to get the printer name to deposit the variable Cprintername
Or use the command set ("Printer", 2) to get the current default printer name
Example:
CHGPRTNAME ("EPSON LQ-1600K", "Visual FoxPro", "My Document Name")
Change the printer EPSON LQ-1600K to the name of Visual FoxPro to my document name
note:
ChgprtName will change all the same print name to the name of its definition, and the judgment condition uses an inaccurate match.
For example, a document name ABC, as long as A or AB, ABC is equivalent to ABC
2. Get the number of print collaps
* - Description: Get the number of print queues
* - Syntax: getPRTDOCS (CPRIntername)
* - Return:
*> 0 A number of larger than 0, that is, the number of tasks in the print queue
* -1 No printer name given
* -2 Internal error occurred in the document in the queue
* Note: If you don't print a document in the queue, return 0
* -5 does not have enough memory
(On the Winnt server, if the print queue contains more than 100 documents, you will produce some errors)
Example:
GetPRTDOCS ("EPSON LQ-1600K" && will get the number of queues waiting for printing on the printer
3, control the status of the print document
* - Description: Set the status of the print document,
* You can suspend, cancel, restart, interrupt one or more print tasks
* The document name given must be consistent with the print manager
* Syntax: setPRTDocState (Cprintername, cdocumentname, nchamand)
*-- Parameter Description:
* Pause 1
* Interrupt 2
* Cancel 3
* Re-start 4
* - Return:
* 0 = Command normal execution
* -1 No printer name given
* -2 Internal error occurred in the document in the queue
* Note: If you don't print a document in the queue, return 0
* -5 does not have enough memory
* -6 parameter does not support
Example:
Now you want to have a print job executing command that is called "My Document" on the printer EPSON LQ1600K:
SetPRTDOCSTATE ("EPSON LQ-1600K", "My Documents", 1)
Remind 1:
Run this FLL file, you must have a msvcrt.dll file on the system
If you don't have this file, when you load the FLL file, you will be prompted by "Invalid or Corrupted libary" error message.
You can copy this file to your system directory, which is usually available on a system with VFP.
Reminder 2:
You can start modifying the name of the print document when you run the report, start modifying in the first page of the report, writing the following report control domain:
IIF (_PAGENO = 1, IIF (chgprtname (...) = 0, "", "", "")
Remind 3:
Register this FLL file
E-mail: Bodecsb@mail.matav.hu or office@mail.matav.hu
Phone: 36 30 9 443 113 OR 36 30 912 050
Download package
chgnage.zip 8.6k