PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Anthony Billingsley on May 31, 2013, 05:26:20 PM

Title: Where to put startup code
Post by: Anthony Billingsley on May 31, 2013, 05:26:20 PM
I’m starting a new database project to learn FF and SQLitening and was wondering where to put my startup code for opening a database connection.  Should I have a module with a “FUNCTION PBMAIN” for startup code or should I just put the code in WM_CREATE in the startup form for the project?  It seems best practice would be to put the code in a module.  What if the simple project really only has one main form, would this make a difference?
Thanks,
Tony
Title: Re: Where to put startup code
Post by: Paul Squires on May 31, 2013, 05:35:32 PM
FF_WINMAIN

(found under "Special Functions" in the Project Explorer)
Title: Re: Where to put startup code
Post by: Anthony Billingsley on May 31, 2013, 06:15:59 PM
I keep forgetting about the "Special Functions"

Thanks
Title: Re: Where to put startup code
Post by: Eddy Van Esch on May 31, 2013, 06:20:51 PM
If I'm not mistaking, FF_WINMAIN is the main entry of your program.
In general, I have atleast one form in my projects, so I make a habit of doing all my init stuff in WM_CREATE (of any form).
All the cleaning up I do in WM_DESTROY (saving the forms size and position, saving control contents, etc.).
In the rare case that you do not have a form, you need to do everything in FF_WINMAIN.