The Delphi Bug List

Entry No.
645
IDE
If setting Application.Title to a previously defined string constant, the IDE will display error messages and fail to load the project the next time one attempts to load it.
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
AbsentAbsentAbsentAbsentAbsentAbsentAbsentAbsentAbsentUnknownExistsExistsExistsExistsUnknown
Description
Reported by Björn Lindell; checked by Jordan Russell
If setting Application.Title to a previously defined string constant, the IDE will display error messages and fail to load the project the next time one attempts to load it. The error doesn't occur if you assign the string directly.

Steps to reproduce (see also included example):

  1. Start Delphi.
  2. Create a New Application
  3. Select "Project/View Source"
  4. Before the "Begin" line, enter the following
        const
          BUGTITLE = 'This will cause problems';
  5. Between the lines "Application.Initialize;" and "Application.CreateForm(TForm1, Form1);", enter the following:
          Application.Title := BUGTITLE;
  6. Save all files.
  7. During saving, you might get "Error in module Project1: Call to Application.CreateForm is missing or incorrect"
  8. If you didn't get the error now, close the project and try to reopen it, then you should get the error.
  9. I also get exceptions, for instance in "CORIDE50" and sometimes "DCLSTD" when exiting Delphi after causing this error.

Note:
If you instead write

    Application.Title := 'This will cause problems';
which is the way Delphi puts in the application title if you specify it in the project options, you will not get an error, and everything works fine.

(Note from checker: Versions of Delphi prior to 5 did display an error when Application.Title was assigned a constant, but they did not generate access violations that interfered with the loading of other projects.)

Mandi Paugh adds:
Bug #645 still exists in Delphi 6 Update Pack 2. However it doesn't cause the IDE to crash, it just issues the error and halts loading the project (it appears to half-load it).

Solution / workaround
It doesn't help calling a procedure to set the title, but you can of course set the title later on in the program (in "FormCreate" of the main form for instance).
User-contributed comments
Damien
16 Jul 2001  02:17 PM GMT
D6 complains similarly but does not crash. However I fail to see what the problem is - just assign the application title in the project options dialog as you are meant to.
Remco
23 Nov 2001  01:30 PM GMT
This also happens when you use the Application.Title multiple times in your project.

The following code:
[code]
Application.Initialize;

Application.Title := 'Title';

FindWindow('TApplication', Pchar(Application.Title));

Application.CreateForm(TXxx, Xxx);
Application.Run;
[code]
causes the same errors.
Latest update of this entry: 2002-02-28

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.