printer object and win64 lazarus / 31-LCL ---------------------------------------------------------------------- tshumak · 2013-09-29 08:32 I'm having trouble getting the printer object to work under 1.0.12 win64 and win7 pro 64.  I have included osprinters, printers in the uses clause, and printer4lazarus is a required dependent of my project.  When I start my project from the IDE, I get several exception dialogs. 1. Project ... raised exception class 'RunError(217).  Clicking continue - 2. Project ... raised exception class 'EControlC' with message:     Control-C hit  Clicking continue - 3. Project ... raised exception class 'ePrinter' with message:     CreateDC Exception: "Control-C hit" (Error: the operation completed successfully.     ", DC=0, Driver="HP Photosmart D110 Series" Device="HP Photosmart D110 Series"      Port="HP_192.168.1.150_CN06RF15PY05N9")    In file '.\win32\winprinters.inc' at line 159 After these the program starts and runs normally.  However when executing the print function  the printer dialog is presented normally, clicking Ok, I get the first 2 exceptions, then the third is now: Project ... raised exception class 'External: SIGSEGV'. Code: [Select]procedure TFMain.PrintScreenClick(Sender: TObject); var   myBitMap : TBitMap;   myPrinter : TPrinter;   paperHeight : integer; begin   //PrintDialog1.MinPage := 1;   //PrintDialog1.MaxPage := 1;   if PrintDialog1.Execute then   Begin     myBitMap := TBitMap.Create;     myBitMap.LoadFromDevice(Canvas.Handle);     //MyPrinter := Printer;     //MyPrinter.BeginDoc;     Printer.BeginDoc;     //printer.Orientation:=poLandscape;     //if MyPrinter.Orientation = poLandscape then     if Printer.Orientation = poLandscape then     //   paperHeight := MyPrinter.PaperSize.Height     paperHeight := Printer.PaperSize.Height     else     //  paperHeight := MyPrinter.PaperSize.Height div 2;       paperHeight := Printer.PaperSize.Height div 2;     //MyPrinter.Canvas.CopyRect(     Printer.Canvas.CopyRect(     //     Classes.Rect(0, 0, MyPrinter.PaperSize.Width, paperHeight),         Classes.Rect(0, 0, Printer.PaperSize.Width, paperHeight),         myBitMap.Canvas, Classes.Rect(0, 0, myBitMap.Width, myBitMap.Height));     //MyPrinter.EndDoc;     Printer.EndDoc;     myBitMap.Free;   end; end; Removing the 64 bit of lazarus version and installing the 32 version, the projects runs without error. I'm sure I'm missing something,  looking for suggestions. Thanks. ---------------------------------------------------------------------- BigChimp · 2013-09-29 08:42 This smells like the problems with error handling in dlls/3rd party code on 64 bit windows that is fixed with the introduction of SEH in FPC 2.7.1 The problem is that errors in dlls that are normally caught inside the dll are erroneously picked up by FPC and interpreted as error 217/ctrl c hit etc. It can happen with running e.g. Firebird embedded database dlls, but also windows explorer plugin dlls that give errors (the bugtracker has examples of both). Perhaps in this case the problem is some (e.g. HP) dlls that cause exceptions that FPC erroneously handles. See http://wiki.lazarus.freepascal.org/Firebird_embedded#Warning:_Windows_ x64 and http://wiki.lazarus.freepascal.org/User_Changes_Trunk#Exception_handli ng_has_been_changed_to_be_ABI-conformant As the Firebird article mentions, if this is indeed the problem, you could: 1. Move to Lazarus with FPC 2.7.1 x64 2. Use Lazarus 32 bit 3. Recompile FPC 2.6.x with the given compiler switch to enable SEH ---------------------------------------------------------------------- tshumak · 2013-09-29 08:58 Hi bc, Thanks for the fast reply.  I would like to move to laz with PFC 2.7.1, but I had problems with getting the trunk versions to compile correctly.  Something with bufdataset_parser not being found.  The files there, I can open it in the IDE, but the compiler doesn't find it.  I could not figure out how to compile the svn either.  I,ll try the trunk downloads again.  But I would like to stay with the stable versions.  I'll look at an updated printer driver as well. ---------------------------------------------------------------------- tshumak · 2013-09-30 01:42 To follow up.  I installed 1.1 with fpc 2.7.1 win64.  I wound up having to completely flush my laz dir.  The IDE now compiles and I added powerpdf, lazreport, and zvdatetime controls.  I compiled my project and it works as it's supposed to! No exception dialogs.  This problem seems to be fixed!  Thanks bc. Anyway the new Lazarus seems to have more features. Lazreport now has controls for its dialogs!  I'm looking forward to using this! Although the help system is broken.  The IDE can find the topics but can't display them.  Something about a viewer not found.  I tried to recompile the help files, still does not work.  Tired setting the help viewer to c:\windows\hh.exe. Still no go.  Anything else I can try? ---------------------------------------------------------------------- BigChimp · 2013-09-30 05:56 Please open a new thread for new unrelated questions. Thanks.