I created a very simple ISAPI DLL with the following code on the default handler:
procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
DevHandle : THandle;
begin
Printer.PrinterIndex := 0;
DevHandle := Printer.Handle;
end;
The second line always fails with "Printer Selected is not Valid." I originally thought this might be a rights issue, but have tried identities with adequate rights. Additionally, the Printer class does return the correct list of printers/drivers matching those installed on my machine.
Is there a way around this error so the default printer can be selected and I can retrieve the printer handle?