I accidentally specified Onenote as the printer here. The result is an Access Violation, somewhere in the RV sources. Of course, nobody uses that. But the AV is unattractive. Any ideas?
RV_GetPrinterDC.....
if LowerCase( Printer.Printers[Printer.PrinterIndex])=LowerCase('OneNote') then
begin
raise Exception.Create('Can''t print to OneNote');
Exit;
end;
Can you tell me which line of TRichView code raises an exception?
I have "OneNote for Windows 10" and "OneNote (Desktop)" printers, both seems to be ok.
Printing to OneNote should not be different from printing to any other printer.
But it's sweeping the problem under the rug.
If an exception happens in the same line of code every time, knowing this line may help to solve the problem.
Can you debug RV_GetPrinterDC?
After calling Printer.GetPrinter, what values are written to ADevice, ADriver, APort?
(only characters before the first #0 matter).
For example, for me:
ADevice = 'OneNote (Desktop)'
ADriver = ''
APort = 'nul:'
I increased the buffer limit ro 1024 characters in TRichView 21.7.1.
The problem is in using VCL's TPrinter.GetPrinter method that copies strings to PChar buffers
I posted a request to Embarcadero for implementation of a safe version of this method, with String instead of PChar, https://quality.embarcadero.com/browse/RSP-42404