Have a Question?
Print

00419: Using the CTRL() function to obtain printer information

Title:

Using the CTRL() function to obtain printer information

Description:

The CTRL() function, Visual PRO/5, can obtain printer resolution and total printable area. It returns information on the default Windows printer. The CTRL(13) template is as follows: 

WIDTH:U(4) 
HEIGHT:U(4) 
HRES:U(4) 
VRES:U(4) 
XOFF:U(4) 
YOFF:U(4) 

NOTE: CTRL(13) is not supported in BBj.

The following code will return the height and width of the printable area and multiply it by 1000 so programming can be done in thousandths of an inch. 

OPEN(1)"X0"
PRINT (1)'WINDOW'(30,90,730,446,"Test Window",$0082$,$03400400$)
DIM CTRL13$:"width:u(4),height:u(4),hres:u(4),vres:u(4)"
LET CTRL13$=CTRL(1,0,13)
LET W=CTRL13.WIDTH*1000
LET H=CTRL13.HEIGHT*1000
LET H=CTRL13.HEIGHT
LET W=CTRL13.WIDTH
LET W=INT(W*1000/CTRL13.HRES)
LET H=INT(H*1000/CTRL13.VRES)
PRINT H,W

Table of Contents
Scroll to Top