Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

А если принтеров несколько. Как назначить нужный? [D7, Win2k]


odessey ©   (2005-01-11 17:35:00) 

Необходимо распечатать файл.
 AssignFile(FileTxt,'с:\1.txt);
 AssignPrn(PrintTxt);
 Reset(FileTxt);
 Rewrite(PrintTxt);
 while Not EOF(FileTxt) do
 begin
  Readln(FileTxt, TempStr);
  Writeln(PrintTxt, TempStr);
 end;
 CloseFile(FileTxt);
 CloseFile(PrintTxt);
А если принтеров несколько. Как назначить нужный?


XmeD   (2005-01-19 13:45:00) [1]

> XmeD   (12.01.05 20:38) [13]

http://delphiworld.narod.ru/base/set_def_printer.html


XmeD   (2005-01-12 20:38:00) [2]

>odessey  

Specifies the current printer.

Delphi syntax:

procedure SetPrinter(ADevice, ADriver, APort: PChar; ADeviceMode: THandle);

C++ syntax:

void __fastcall SetPrinter(char * ADevice, char * ADriver, char * APort, int ADeviceMode);

Description

Call SetPrinter to change the current printer.

ADevice specifies the device name of the new printer. This is the name that appears in the Print Manager (for example, "Epson FX-80"). It is not the printer model name.

ADriver specifies the driver name for the new printer (usually ‘WINSPOOL’).

APort is included for backward compatibility. It should be set to an empty string.

DeviceMode is the handle to a memory buffer device-specific initialization data for the device driver. This handle can be obtained by calling the GlobalAlloc function to allocate a DeviceMode record (Delphi) or DEVMODE structure (C++).


odessey   (2005-01-12 19:35:00) [3]


> XmeD

пробывал....все равно посылает на локальный


XmeD   (2005-01-12 19:30:00) [4]

У меня 2 принтера, локальный и сетевой......назначаю сетевой, все равно пускает печать на локальный(

Читай внимательно

Семен Сорокин ©   (11.01.05 17:36) [1]
printers.pas

Printer.PrinterIndex


Прописывай в
Uses
 Printer

...

Printer.PrinterIndex := i;


XmeD   (2005-01-12 19:30:00) [5]

У меня 2 принтера, локальный и сетевой......назначаю сетевой, все равно пускает печать на локальный(

Читай внимательно

Семен Сорокин ©   (11.01.05 17:36) [1]
printers.pas

Printer.PrinterIndex


Прописывай в
Uses
 Printer

...

Printer.PrinterIndex := i;


odessey   (2005-01-11 18:22:00) [6]

А так не получается

if PrintDialog1.Execute then
 CopyFileTo('c:\1.txt','PRN') ;

У меня 2 принтера, локальный и сетевой......назначаю сетевой, все равно пускает печать на локальный(


odessey   (2005-01-11 17:51:00) [7]

эм....прошу прощения....разобрался :)


odessey   (2005-01-11 17:46:00) [8]

:)

> Ega23

PrintDialog1.Execute then
begin
  AssignFile(FileTxt,'с:\1.txt);
AssignPrn(PrintTxt);
Reset(FileTxt);
Rewrite(PrintTxt);
while Not EOF(FileTxt) do
begin
 Readln(FileTxt, TempStr);
 Writeln(PrintTxt, TempStr);
end;
CloseFile(FileTxt);
CloseFile(PrintTxt);
end;

....игнорирует....


Darrin   (2005-01-11 17:42:00) [9]

а SetPrinter() ?


odessey   (2005-01-11 17:42:00) [10]


> Семен Сорокин ©  

если не трудно по-подробнее


Ega23   (2005-01-11 17:42:00) [11]

пробывал..не хочет...(

Код в студию!


odessey   (2005-01-11 17:40:00) [12]


> Ega23 ©   (11.01.05 17:38) [2]
> TPrintDialog ?

пробывал..не хочет...(


Ega23   (2005-01-11 17:38:00) [13]

TPrintDialog ?


Семен Сорокин   (2005-01-11 17:36:00) [14]

printers.pas

Printer.PrinterIndex


Наверх

Титульная страница Поиск, карта сайта Написать письмо