Re: Previewing
"Will Watts" <[email protected]> Wed, 13 Nov 2002 18:21:53 -0000
| Newsgroups | gmane.comp.lang.delphi.quick-reports |
|---|---|
| Organization | Applied Industrial Systems Ltd |
| Message-ID | <3DD29841.30242.A90DDBD@localhost> |
On 13 Nov 2002 at 11:36, Tom Nesler wrote:
> If I were you and were conecerned about this, I would create a generic
> routine to call prior to running any QR reports that would get the
> default printer. If it failed then I would notify the user about the
> problem and stop the process.
Agreed. Here is the code I use to do this. The procedure SFWError
raises our standard exception, which is displayed to the user.
procedure TMain.EnsureDefaultPrinterExists;
begin
if not CheckForDefaultPrinter then
SFWError('You do not have a default printer defined.' +
#13#13 + 'Please select a printer before running a report.');
end;
function TMain.CheckForDefaultPrinter: Boolean;
var
FDevice: string;
FDriver: string;
FPort: string;
FHandle: THandle;
begin
SetLength(FDevice, 255);
SetLength(FDriver, 255);
SetLength(FPort, 255);
Printer.GetPrinter(PChar(FDevice), Pchar(FDriver), PChar(FPort),
FHandle);
result := not IsEmpty(FDevice);
end;
--
Will Watts Direct Line +44 20 8400 6104
Applied Industrial Systems Ltd Main Voice +44 20 8400 6100
10 Barley Mow Passage Fax +44 20 8742 2456
Chiswick London W4 4PH Web http://www.applied.co.uk
=============================================
QReport Artist 5 - http://www.mensand.com/
The new version is available for Delphi 5.0 ,
Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0
=============================================
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/