In the application I wrote, I used this code to read the printer name

      GetMem(PrinterName,32);
      Temp:='';
      try
         SysReg:=TRegistry.Create;
         SysReg.RootKey:=HKEY_CURRENT_CONFIG;

SysReg.OpenKey('System\CurrentControlSet\Control\Print\Printers',False);
         Temp:=SysReg.ReadString('Default');
      except
      end;
      if Temp<>''
         then PrinterName:=PChar(Temp);

      POpenRes:=OpenPrinter(PrinterName,PrinterHandle,nil);

In this case the printer name in the Registry is "HP LaserJet 4L"

Sometimes you see names in the format "HP LaserJet 4L on LPT2:" and it may
be that this is an incorrect format. Check to see what you are getting. My
guess is that the name is of an icon in the Printers folder in Control
Panel.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, 2 June 1999 15:46
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Counting pages printed- problem with openprinter
>
>
> I have the following code to get the handle for the printer but i
> just the
> error \"paramaters are incorrect\". Any ideas as to what
> paramater in incorrect
> and why?
>
snip

============================================
Patrick Dunford, Christchurch, NZ
http://patrick.dunford.com/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to