Check for existence of file/modify WINMAIN increases build times

I've built an app with a database; the app also has considerable utility
without access to the daatabase. So, if the database is lost, I want the
user to be able to go ahead and run without it.

After trying a few things that didn't work,

in WINMAIN, int GetHandle =open("DatabaseFile", O_RDONLY);
if (long DoesExist = filelength(GetHandle)<2)
    create the forms that access the database
    }    file's too short, forms don't get created

then in main form OnCreate,
int GetHandle = open("DatabaseFile", O_RDONLY);
if (long DoesExist = filelength(GetHandle)<2)
    bool DBQuest = false;
    Application->MessageBox(<database doesn't exist>);

through rest of program, any access to database is inside {   } after

if(DBQuest == true)

All this works like I want BUT, one, I know there's an easier, more elegant
way, and, two, since I've done this, my build times have increased from just
over 30 seconds to over 90 seconds.

Thanks in advance for any enlightenment.