Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using win32 api to determine a printer type... 4

Status
Not open for further replies.

XPPROGRAMMER

Programmer
Nov 15, 2004
44
US
Hello,

is there a win32 api that will determine the type of
the default printer (example: Laser or Dot-Matrix)?

thanks for the kind help.
 
Yes there is (EnumPrinters and EnumPrintersEx, if I am not wrong), but if you don't tell us what you need to do, and with which COBOL vendor/version and OS version it is hard to help you.


Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Hello Frederico,

I am using windows xp pro with micro focus netexpress 3.1
cobol compiler. I need to print a contract form that has
five carbon copies if the default printer is a dot-matrix,
otherwise just print a summary report when it is a laser
printer. The end-user will switch between two printers
with a manual switch based on his printing needs. So, I
need to test the default printer and print accordingly.

thanks for the kind help.
 
This one is tough. Windows is designed to obscure specifics about printers in favor of a common printing model. Windows expects the user to select the type of the printer manually, not via some automatic interaction. Differences in printers are then accounted for in the printer driver thus selected.

You can enumerate the printers installed on the machine and can get information about the currently selected printer. However, I believe that much of the returned information is driver-specific. Also, you should note that simply throwing a manual switch will normally not be enough; you'll have to switch printer selections (e.g. through a Print Setup dialog).

That said, I think you can interact some with the parallel port and PERHAPS manage to do this.

Personally, I'd re-think the design and approach it differently.

Regards.

Glenn
 
XPPROGRAMER, I'm not absolutely sure that it works, but, if you can "GetDeviceCaps" for the printer you are interested in, then look at the field "Technology". For a Dot Matrix printer it is DT_CHARSTREAM, for a Laser or Inkjet it is DT_RASPRINTER. I hope it helps.



Theophilos.

-----------

There are only 10 kinds of people: Those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top