Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

PrinterSetupDialog1.Execute won't work.

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Larry Dalton

I can't get PrinterSetupDialog1.Execute to work on Lazarus 1.4.2, FPC 2.6.4, on Windows 7.

I couldn't get it to work in a program that I have used for a long time, so I built a simple test program, and get the same error code.

Here is the complete program:

unit printertestunit;
{$mode objfpc}{$H+}
interface

uses
Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs,

  StdCtrls,Messages,Buttons;
type
  { TPrinterTest }
  TPrinterTest = class(TForm)
    Button1: TButton;
    PageSetupDialog1: TPageSetupDialog;
    PrintDialog1: TPrintDialog;
    PrinterSetupDialog1: TPrinterSetupDialog;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;
var
  PrinterTest: TPrinterTest;
implementation
{$R *.lfm}

{ TPrinterTest }

procedure TPrinterTest.Button1Click(Sender: TObject);
var message_string:string;
begin
  PrinterSetupDialog1.Execute;
    if PrintDialog1.Execute then message_string:='Executed ok' else
message_string:=
    'Not executed';
    if messagedlg(message_string,mtconfirmation,[mbok],0)=mrok then
end;
procedure TPrinterTest.FormCreate(Sender: TObject);
begin
end;
end.
{here is the lpr}
 program printertest;
{$mode objfpc}{$H+}

uses

  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,printertestunit
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, printertestunit, printer4lazarus
  { you can add units after this };
{$R *.res}
var MyTest:TPrinterTest;
begin
  RequireDerivedFormResource := True;
  Application.Initialize;
  MyTest:=TPrinterTest.Create(application);
  Application.Run;
end.

Required Packages are LCL and Printer4lazarus.

When I execute button1click I get the following error: "Project printertest raised exception class 'RunError(217)'"

Clicking on Continue I get the subsequent error message: Project printertest raised exception class 'EControlC' with message: 'Control-C hit.'

Any ideas on this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150826/2fb2a706/attachment-0001.html>

Reply by email

Bart
to Larry Dalton
Larry Dalton wrote 10 lines
I can't get PrinterSetupDialog1.Execute to work on Lazarus 1.4.2, FPC 2.6.4, on Windows 7. When I execute button1click I get the following error: "Project printertest raised exception class 'RunError(217)'" Clicking on Continue I get the subsequent error message: Project printertest raised exception class 'EControlC' with message: 'Control-C hit.'

No such problems here with Lazarus 1.4.3 r49717 FPC 2.6.4 i386-win32-win32/win64.

Can you run the progrm inside gdb and then do a backtrace?

Bart

Reply by email

Larry Dalton
to Bart

Not familiar with gdb

Sent from my iPhone

Show quoted text 25 lines
On Aug 26, 2015, at 15:28, Bart wrote: > On 8/26/15, Larry Dalton wrote: > I can't get PrinterSetupDialog1.Execute to work on Lazarus 1.4.2, FPC > 2.6.4, on Windows 7. > When I execute button1click I get the following error: > "Project printertest raised exception class 'RunError(217)'" > > Clicking on Continue I get the subsequent error message: > Project printertest raised exception class 'EControlC' with message: > 'Control-C hit.' No such problems here with Lazarus 1.4.3 r49717 FPC 2.6.4 i386-win32-win32/win64. Can you run the progrm inside gdb and then do a backtrace? Bart -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Larry Dalton
to Bart: No such problems here with Lazarus 1.4.3 r49717 FPC 2.6.4 i386-win32-win32/win64. Can you…

Had to give up and go to 32 bit

Sent from my iPhone

Show quoted text 25 lines
On Aug 26, 2015, at 15:28, Bart wrote: > On 8/26/15, Larry Dalton wrote: > I can't get PrinterSetupDialog1.Execute to work on Lazarus 1.4.2, FPC > 2.6.4, on Windows 7. > When I execute button1click I get the following error: > "Project printertest raised exception class 'RunError(217)'" > > Clicking on Continue I get the subsequent error message: > Project printertest raised exception class 'EControlC' with message: > 'Control-C hit.' No such problems here with Lazarus 1.4.3 r49717 FPC 2.6.4 i386-win32-win32/win64. Can you run the progrm inside gdb and then do a backtrace? Bart -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Patrick Chevalley

Hi,

I don't use win64 a lot but this remember me a problem I have a few years ago. Try to add the following at the start of your project .lpr file:

{$ifdef  win64}
  {$IMAGEBASE $400000}
{$endif}

For me this fixed both debugging and printing on win64.

Patrick

Had to give up and go to 32 bit

Sent from my iPhone

Show quoted text 25 lines
On Aug 26, 2015, at 15:28, Bart wrote: > On 8/26/15, Larry Dalton wrote: > I can't get PrinterSetupDialog1.Execute to work on Lazarus 1.4.2, FPC > 2.6.4, on Windows 7. > When I execute button1click I get the following error: > "Project printertest raised exception class 'RunError(217)'" > > Clicking on Continue I get the subsequent error message: > Project printertest raised exception class 'EControlC' with message: > 'Control-C hit.' No such problems here with Lazarus 1.4.3 r49717 FPC 2.6.4 i386-win32-win32/win64. Can you run the progrm inside gdb and then do a backtrace? Bart -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email