Strange behaviour, this. Your structure is the exact copy of my initialization procedure. My main is as follows:
int main (int argc, char *argv[])
{
// Initialization
...
//-----------------------------------------------------
// Preliminary checks and loading parameters from disk
// CanStart () returns 1 on error
//-----------------------------------------------------
if (CanStart (x)) exit (EXIT_FAILURE);
// Program start completion: loading of main panel
RunUserInterface ();
// Program conclusion
return 0;
}
The function for initial checks has this structure:
int CanStart (int x)
{
int errors = 0;
// Loading a panel for user information during checks
// If some error is found => errors++;
if (errors) {
// Display a message on the panel
// Enable a 'OK' button to quit the program
GetUserEvent (1, &pnl, &ctl);
}
return errors;
}
It works: the program waits for the user to press OK button before exiting.
Hope this helps
Roberto