Creating form dinamically - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Creating form dinamically

tijoentijoen Posts: 141Member
Hi, I am creating the form dinamically and I would like to change the name of the form before it is created, so I can access it by findWindow when I need...
But I am getting errors whe nI close the main form...
any ideas?

thanks

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hi, I am creating the form dinamically and I would like to change the name of the form before it is created, so I can access it by findWindow when I need...
    : But I am getting errors whe nI close the main form...
    : any ideas?
    :
    : thanks
    :
    That's possible. First you need to remove the form from the "Auto-create forms" (Project Options). Then you need to edit the project source file, so that it creates the form without any owners. After that you can set the Name property to whatever you like. Finally you can insert that form into the Application by calling InsertComponent().
    This however will not change the classname, since that cannot be changed during runtime. Also FindWindow() doesn't search for the Name property but for the Caption of the form.
    As for the errors, those can happen when other programs are still using the window handle, after the form (and thereby its handle) has been destroyed.
Sign In or Register to comment.