In C ++ Builder, We dynamically change the custom printing paper-Linux general technology-Linux programming and kernel information. The following is a detailed description. Because only Delphi examples are provided on the Internet and some examples are unavailable when CB is used for compiling, I simply searched the information and wrote it myself, I am afraid that the netizens will encounter this kind of situation when programming, so they will immediately upload it.
Void _ fastcall TForm1: BitBtn1Click (TObject * Sender)
{
Char * ADevice, * ADriver, * APort;
THandle DeviceMode;
PDeviceMode DevMode;
Int length, width;
Length = 1400;
Width = 2410; // set the size of the Custom paper to 0.1mm
ADevice = new char [100];
ADriver = new char [100];
APort = new char [100];
// Obtain the printer
Printer ()-> GetPrinter (ADevice, ADriver, APort, DeviceMode );
// Obtain the PDevMode Structure
DevMode = (_ devicemodeA *) GlobalLock (void *) DeviceMode );
// Set the value that can be modified
DevMode-> dmFields = DevMode-> dmFields | DM_PAPERSIZE;
DevMode-> dmFields = DevMode-> dmFields | DM_PAPERLENGTH;
DevMode-> dmFields = DevMode-> dmFields | DM_PAPERWIDTH;
// Set the value to be modified
DevMode-> dmPaperSize = DMPAPER_USER; // set as custom paper
DevMode-> dmPaperLength = length;
DevMode-> dmPaperWidth = width;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.