I changed the code as suggested and now I get the error: 'System Error.
Code: 1801. The printer name is invalid'. I have been searching the web for
clues on this one but haven't found anything yet. If anyone has an idea
please let me know.
Regards,
Edward
> > if Assigned(CreateHandleFunc) then
> > with TPrinterDevice(Printers.Objects[PrinterIndex]) do
> > begin
> > DC := CreateHandleFunc(PChar(Driver), PChar(Device), PChar(Port),
> > DevMode);
>
> Replace that line with
> DC := CreateHandleFunc(PChar(Driver), PChar(Device), nil, DevMode);
>
> > if DC = 0 then RaiseError(SInvalidPrinter);
>
> Replace this line with
> if DC = 0 then
> if Sysutils.Win32Platform = VER_PLATFORM_WIN32_NT then
> RaiseLastOSError
> else
> RaiseError(SInvalidPrinter);
>
> > if FCanvas <> nil then FCanvas.Handle := DC;
>
> Run some tests. If the call to create the device context handle fails you
> should at least get a more informative error message.