Win64 range check error on TForm.FormKeyUp lazarus / 31-LCL ---------------------------------------------------------------------- nikkho · 2011-08-15 12:03 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 · 2011-08-15 12:22 From Lazarus wiki: QuoteNote: 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 ---------------------------------------------------------------------- Leledumbo · 2011-08-15 12:50 Or perhaps LCLIntf.OpenDocument? ---------------------------------------------------------------------- nikkho · 2011-08-15 15:29 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 · 2011-08-15 21:57 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 · 2011-08-16 15:02 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 · 2011-08-17 05:27 I can't see the image, it says blocked login ---------------------------------------------------------------------- nikkho · 2011-08-17 07:21 Is it working here? (http://guti.bitacoras.com/_temp/rangeerror.png) ---------------------------------------------------------------------- Leledumbo · 2011-08-17 12:00 OK, I can see that. It's LCL's default exception handler, perhaps you can try Code: [Select]Application.OnException := nil;Before Application.Run;