PDA

View Full Version : Selecting Printer and Paper Bins


Unregistered
October 26, 2002, 11:57:01
It would be helpful if you could publish a programming example which demonstrates
- how to select a printer by program, not by dialog
- how to select a paper bin, also by program
I am personally interested in an example written in Delphi, but the subject should belong to the core functionality of textcontrol, so examples also in C++, Basic etc. are useful.

Sincerely Yours

Volker


This message was originally posted by Volker Trimkowski in the old TX Text Control Support Forum.

Unregistered
October 26, 2002, 13:57:06
How to select a printer:

printer.printerIndex:=x (x is the printer-ID, the default-printer is always -1)

How to select a paperbin:

procedure TMDIChild.SetPrinterBin(PaperBin:integer);
var
aDevice, ADriver, aPort:array[0..255] of char;
PDMode:PDEV`MOD`E;
hdMode:THandle;
begin
Printer.GetPrinter(aDevice, aDriver, aPort, hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then pDMode^.dmDefaultSource := PaperBin; //269;
Printer.SetPrinter(aDevice,aDriver,aPort,hdMode);
GlobalUnlock(hDMode);
end;
end;


This message was originally posted by Patrick in the old TX Text Control Support Forum.

Unregistered
October 26, 2002, 15:59:09
You need to do something like this

Dim objPrinter As Printer

If Printer.DeviceName <> NewPrinterName Then
For Each objPrinter In Printers
If UCase$(objPrinter.DeviceName) = NewPrinterName Then
Set Printer = objPrinter
Exit For
End If
Next
End If

For something like a paper bin just do

printer.PaperBin = ???

Bearing in mind that that code will be printer specific.


This message was originally posted by Peter Meachem in the old TX Text Control Support Forum.