[Lazarus] Exception in CreateForm after conversion from Delphi
Frederic Da Vitoria
davitofrg at gmail.com
Thu Nov 21 12:13:19 CET 2013
I am converting a set of old small applications which I probably wrote in
Delphi 1 or 2, first version of the sources I have dates from 1996, last
version (the version I am converting to Lazarus) from 1999, probably last
updated in Delphi 3
I already did the conversion once with Lazarus 1.2 RC1. This first
conversion had to be redone because Lazarus signaled an error converting
the .res file. I don't remember what I did exactly, but I finally got a
conversion without the .res error.
Running the new application raised an exception during creation of the main
form (this will be explained below), so I decided to start again from a new
conversion using Lazarus 220.127.116.11.
Lazarus 18.104.22.168 again signals an error while converting the .res file.
First compilation shows a few simple warnings about hiding inherited
methods. I also get a hint about an exitProc which I'll explain later. So I
remove them with hints and recompile. Lazarus hangs at that point, nothing
in the output window, impossible to close the IDE (although it is
responsive, I can for example open menus). I end up stopping Lazarus
After reloading Lazarus, I get the same error about the .res file. I
overwrite the .res with the one 1.2 RC1 generated, and now it compiles.
When running the application, I get again the same exception. So I decide
to try to correct some code which is probably not valid any more: I move
the contents of an exitProc to the finalization section and remove exitproc
I still get the same exception as with 1.2 RC1: error 1407 in
Win32WSControls.FinishCreateWindow. This is triggered by the first
CreateForm which is in the dpr. If I comment out the CreateForm, I get the
same exception for the next CreateForm. The debugger shows that upon
calling CreateWindowEx, pClassName contains "Window".
I found on the Lazarus forum a discussion about error 1407 in 2009. The
solution was to add Application.initialize in the lpr. But the converter
did not create a lpr file, so I checked the dpr file and indeed found that
Application.initialize was missing. Adding it solved my problem.
Why didn't the converter create a lpr file? Did I do something in the
settings which caused this? I checked the conversion by 1.2 RC1, I did get
a lpr, but it did not contain Application.initialize either. Shouldn't the
converter add this line?
What are those .res conversion errors? The only reference I found is in the
Code_Conversion_Guide, but it seems quite outdated, and I could not find
reference to the resources files in the converter documentation.
Frederic Da Vitoria
Membre de l'April - « promouvoir et défendre le logiciel libre » -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Lazarus