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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.