Recent

Author Topic: Win64 range check error on TForm.FormKeyUp  (Read 9220 times)

nikkho

  • Newbie
  • Posts: 4
Win64 range check error on TForm.FormKeyUp
« on: August 15, 2011, 02:03:40 pm »
I am trying to build a Win64 version of my application. It works fine as a Win32 binary, but on x64, it produces a range error exception.

I have been able to reproduce it using 0.9.30, and also 0.9.31 + FP 2.4.4 and 0.9.31 + FP 2.5.1.

The problem can be reproduced by creating an empty form, and mapping the FormKeyUp event to something like:
Code: [Select]
procedure TfrmMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
    if (Key = VK_F1) then
    begin
        ShellExecute(0, 'open', pchar(Application.HelpFile), '', '', SW_SHOWNORMAL);
        Pause(2000);
    end;
end;

Can anyone confirm if this is a known issue? Any hint for solving it?

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Win64 range check error on TForm.FormKeyUp
« Reply #1 on: August 15, 2011, 02:22:56 pm »
From Lazarus wiki:
Quote
Note: FPC/Lazarus has support for ShellExecute and/or WinExec, but this support is only in Win32. If your program is cross-platform, then use TProcess, it is the best way!

See: http://wiki.lazarus.freepascal.org/Executing_External_Programs
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Leledumbo

  • Hero Member
  • *****
  • Posts: 8819
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Win64 range check error on TForm.FormKeyUp
« Reply #2 on: August 15, 2011, 02:50:30 pm »
Or perhaps LCLIntf.OpenDocument?

nikkho

  • Newbie
  • Posts: 4
Re: Win64 range check error on TForm.FormKeyUp
« Reply #3 on: August 15, 2011, 05:29:53 pm »
Thank you for your tips Blaazen, and Leledumbo.

Hi tried both, and no success. After that, I created a new emtpy form, with an empty OnKeyUp handler as follows:
Code: [Select]
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
    //
end;

Problem was exactly the same, Tried to debug, and GDB crashed with a Runtime(201) error Tried on release, and the same Range error.

This is why I am tending to think in an issue with Lazarus, Freepascal, or LCL itself under Win64.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8819
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Win64 range check error on TForm.FormKeyUp
« Reply #4 on: August 15, 2011, 11:57:32 pm »
I'm not sure whether Win64 debugging issue has been resolved or not. Have you tried running outside the IDE? If you compile with -gl a backtrace showing the exact location of range check error should appear.

nikkho

  • Newbie
  • Posts: 4
Re: Win64 range check error on TForm.FormKeyUp
« Reply #5 on: August 16, 2011, 05:02:05 pm »
Just rried with -gl in my empty project as suggested, but no stacktrace at all.
See screenshot: http://img856.imageshack.us/img856/7344/rangeerror.png

Leledumbo

  • Hero Member
  • *****
  • Posts: 8819
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Win64 range check error on TForm.FormKeyUp
« Reply #6 on: August 17, 2011, 07:27:31 am »
I can't see the image, it says blocked login

nikkho

  • Newbie
  • Posts: 4
Re: Win64 range check error on TForm.FormKeyUp
« Reply #7 on: August 17, 2011, 09:21:30 am »
Is it working here?
(http://guti.bitacoras.com/_temp/rangeerror.png)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8819
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Win64 range check error on TForm.FormKeyUp
« Reply #8 on: August 17, 2011, 02:00:56 pm »
OK, I can see that. It's LCL's default exception handler, perhaps you can try
Code: [Select]
Application.OnException := nil;Before Application.Run;

 

TinyPortal © 2005-2018