[Lazarus] range check error with TMainMenu/TMenuItem in win64

Seth Grover sethdgrover at gmail.com
Mon Nov 14 18:55:54 CET 2011

I'm currently running FPC 2.4.4 (built from SVN) on Windows Server
2008 R2 cross-compiling targeting Win64/x86_64. I retrieved lazarus from subversion and built the LCL to be able to target
win64/x86_64 for GUI apps as well. I then follow these steps:

1. Create a new application
2. Add a TMainMenu to the form
3. Add a single menu item to the main menu

I compile the application for win64/x86_64 and run it. Upon running
the app, I get this:

Range check error.
Press OK to ignore and risk data corruption.
Press Cancel to kill the program.

The backtrace shows:

C:\temp> .\project1.exe
TApplication.HandleException Range check error
  Stack trace:
  $0000000000538059  TWINCONTROL__DOKEYUPBEFOREINTERFACE,  line 5857
of ./include/wincontrol.inc
  $000000000053B49D  TWINCONTROL__CNKEYUP,  line 6970 of
  $000000000040C7D6  TOBJECT__DISPATCH,  line 472 of
  $0000000000536085  TWINCONTROL__WNDPROC,  line 5241 of
  $000000000041FAE1  TCUSTOMFORM__WNDPROC,  line 1362 of
  $00000000005C12FE  DELIVERMESSAGE,  line 110 of lclmessageglue.pas
  $000000000056D6E8  WINDOWPROC,  line 2441 of win32callback.inc
  $00000000005C3B07  CUSTOMFORMWNDPROC,  line 357 of win32wsforms.pp

I tried googling for a similar issue but didn't see anything specific
to TMainMenu with win64. I'm sort of baffled by this, since I can't be
the only one out there trying to target win64.

Has anyone else seen this?


This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover

More information about the Lazarus mailing list