Where to put startup code

Started by Anthony Billingsley, May 31, 2013, 05:26:20 PM

Previous topic - Next topic

Anthony Billingsley

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

Paul Squires

FF_WINMAIN

(found under "Special Functions" in the Project Explorer)
Paul Squires
PlanetSquires Software

Anthony Billingsley

I keep forgetting about the "Special Functions"

Thanks

Eddy Van Esch

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.

Eddy