I regularly change the Application Title in the main form and it has never
crashed.  I use it to display progress of some processing while the app is
minimized.

Ross.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Barton Bresnik
Sent: Friday, 3 August 2007 13:55
To: [email protected]
Subject: Re: crashes when I try to use Application.Title

This issue may trace back to MS Windows API: memory must be allocated for
the title. If you set the title at design time, Delphi is usually
intelligent enough to pre-allocate the memory. At run time, setting it equal
to a string value will crash an app, because strings are lifetime-managed:
once it goes out of scope (e.g. at the end of a procedure), the title points
to an invalid location.

Work-arounds: global strings that last the lifetime of the app; allocate
memory for a buffer; allocate an array of char...

Bart

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to