Re: [DUG]: Printing from NT via ASP

1999-03-09 Thread pjones



Oh, the joys of NT desktop sessions and security.  You will need to have
the dll 'run' as a specific user to install a printer driver for the user
account that is running the dll.  If it's IIS 4 then your NTS setup should
let you specifiy the identity.






Dave O'Brien [EMAIL PROTECTED] on 10/03/99 07:37:15

Please respond to [EMAIL PROTECTED]

To:   Multiple recipients of list delphi [EMAIL PROTECTED]
cc:(bcc: Peter Jones/LogisticsInformation
  Technology/Christchurch/Foodstuffs)
Subject:  [DUG]:  Printing from NT via ASP




Hi there...

I have written a dll to print simple reports (using tprinter) which
resides on an NT server and is supposed to be called from ASP. The dll
works fine when called from outside the web server, but when called from
ASP returns 8000 "There is no default printer currently selected".

Has anyone any ideas? It would seem that ASP can't see any printers. I
have tried using the default, and setting specific printers
(Printer.PrinterIndex = x).

Cheers,
David O'Brien.
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz






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



RE: [DUG]: Printing from NT via ASP

1999-03-09 Thread Dave O'Brien

Great... Thanks.
Why didn't I think of that...
Install the dll as a component in a new MTS package, making the package
log on as a specific user.

It never used to be this complicated!

Thanks again.
Dave.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 10 March 1999 09:54
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Printing from NT via ASP




Oh, the joys of NT desktop sessions and security.  You will need to have
the dll 'run' as a specific user to install a printer driver for the
user
account that is running the dll.  If it's IIS 4 then your NTS setup
should
let you specifiy the identity.






Dave O'Brien [EMAIL PROTECTED] on 10/03/99 07:37:15

Please respond to [EMAIL PROTECTED]

To:   Multiple recipients of list delphi [EMAIL PROTECTED]
cc:(bcc: Peter Jones/LogisticsInformation
  Technology/Christchurch/Foodstuffs)
Subject:  [DUG]:  Printing from NT via ASP




Hi there...

I have written a dll to print simple reports (using tprinter) which
resides on an NT server and is supposed to be called from ASP. The dll
works fine when called from outside the web server, but when called from
ASP returns 8000 "There is no default printer currently selected".

Has anyone any ideas? It would seem that ASP can't see any printers. I
have tried using the default, and setting specific printers
(Printer.PrinterIndex = x).

Cheers,
David O'Brien.

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







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



RE: [DUG]: Printing from NT via ASP

1999-03-09 Thread Carl Reynolds

I have written a dll to print simple reports (using tprinter) which
resides on an NT server and is supposed to be called from ASP. The dll
works fine when called from outside the web server, but when called
from
ASP returns 8000 "There is no default printer currently selected".

Has anyone any ideas? It would seem that ASP can't see any printers. I
have tried using the default, and setting specific printers
(Printer.PrinterIndex = x).

Cheers,
David O'Brien.

Not sure if this is what you want, but have a look (from the Delphi
known issues list).

Area: vcl\dialog controls\tprintersetupdialog
Reference Number: 465 (Published: 12/17/98) 
Status: Deferred to Next Rel 
Date Reported: 5/5/98
Severity: Commonly Encountered
Type: Basic Functionality Failure
Problem:
Under Windows NT 4 (SP3) the printer dialog and 
printer setup dialog will always show the default 
printer, not the one chosen through 
Printer.PrinterIndex. Under Win95 (and Win 3.1 with 
D1) the PrinterIndex printer is the one chosen in the 
dialog.

This can be worked around by calling 
Printer.GetPrinter followed by Printer.SetPrinter, with 
a 0 parameter for hDevMode, to force TPrinter to 
update its info.
Steps:
The following event handler shows what is 
neccessary to have the NT4 printer dialogs to show 
the correct printer after PrinterIndex is set in code. If 
the GetPrinter and SetPrinter calls are commented 
out then the dialogs will always show the default 
printer, not the PrinterIndex one.

procedure TForm1.Printersetup1Click(Sender: 
TObject);
var
  Device : array[0..255] of char;
  Driver : array[0..255] of char;
  Port   : array[0..255] of char;
  hDMode : THandle;
begin
  Printer.PrinterIndex := 1; { set to any non-default 
printer }
  Printer.GetPrinter(Device, Driver, Port, hDMode);
  Printer.SetPrinter(Device, Driver, Port, 0);

  if PrinterSetupDialog1.Execute then begin
Memo1.Lines := Printer.Printers;
  end;
end;

Cheers,

Carl Reynolds  Ph: +64-9-4154790
CJN Technologies Ltd. Fax: +64-9-4154791
[EMAIL PROTECTED]DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/

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