Renaming form class

From: Tito Serenti (serenti_at_operamail.com)
Date: 12/31/03


Date: Wed, 31 Dec 2003 14:15:44 -0000

Hi,

Is there anything wrong, or are there any dangers in renaming the class of
the form so it doens't correspond with the name of the form?

For example, if my application's main form is named MainDlg, the class is
automatically named TMainDlg. In order to easily find the form's handle from
another application, I renamed the class to a more uniquely identifiable
TNF30Designer, while leaving the form named MainDlg. This way I can easily
find my application by calling

FindWindow(PChar('TNF30Designer'), PChar(nil))

and be sure that it's the right application and of the right version (30)
too.

So the creation of the form looks like this:

begin
  Application.Initialize;
  Application.CreateForm(TNF30Designer, MainDlg);

The reason I'm asking is because every time I create a new form, Delphi (7)
renames TNF30Designer in the above clause back to TMainDlg, which makes me
think that maybe there's something wrong with doing this.

If you see anything wrong with this, could you please point it out to me? I
don't want to hinge my programming on wrong assumptions and have to later
pay the fidler, so to speak.

Thank you for your help.

Tito