Robert Gilland 5 Posted December 9 I borrowed the below function from jclPrint.pas using Delphi 10.4.2 When function is called the entire process fails. What could be wrong. function GetPrinterResolution: TPoint; begin Result.X := GetDeviceCaps(Printer.Handle, LogPixelsX); Result.Y := GetDeviceCaps(Printer.Handle, LogPixelsY); end; Share this post Link to post
PeterBelow 239 Posted December 9 If you put a breakpoint on the first GetDeviceCaps line, do you reach it when running under the debugger? If so, does Printer.Handle have a reasonable value? Are you dealing with a network printer here that may be offline? So many questions, so little data... Share this post Link to post
Robert Gilland 5 Posted December 9 By sheer exasperation, I removed the conditionals for FASTMM4 LogMemoryLeakDetailToFile and FullDebugMode. And then GetDeviceCaps worked, no idea why. Another day of banging my head against the wall ends miraculously, Thank God. Share this post Link to post
Robert Gilland 5 Posted December 9 1 minute ago, PeterBelow said: If you put a breakpoint on the first GetDeviceCaps line, do you reach it when running under the debugger? If so, does Printer.Handle have a reasonable value? Are you dealing with a network printer here that may be offline? So many questions, so little data... Yes I did that. Share this post Link to post
eivindbakkestuen 47 Posted December 12 On 12/9/2024 at 9:55 PM, Robert Gilland said: And then GetDeviceCaps worked Probably the printer was offline or unreachable before; and then it was reachable. This happens every day here when trying to print from many, even well known applications; they take forever to time out if the default printer wasn't turned on. You could try using a worker thread for printing, then your application doesn't freeze and you have some control over what happens Share this post Link to post