>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 8000ffff "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