Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 689
  • Last Modified:

Exit(0) in "FormActivate" produces exception & error Cannot change Visible in Ohshow or OnHide

I inherited a program that I am now responsible for and in the "TfrmMain::FormActivate" routine there are a few places that check for an instrument alive on the GPIB bus and if its not, an error is displayed and then the code performs an "exit(0)".  When this happens and I'm in the debugger I get the following error message:

"Project RF_CCA_Ttest.exe raised exception class EInvalidOperation with message 'Cannot change Visible in OnShow or OnHide'.  Process stopped.  Use step or Run to Continue."

I am in the FormActivate event procedure not an OnShow or OnHide.  Anyway how can I shut the program down from within the FormActivate event procedure?

Thanks!
0
stimmis
Asked:
stimmis
1 Solution
 
CayceCommented:
Application->Terminate() should do fine.

If it doesn't on your application then you need to close a couple forms before terminating.
0
 
George TokasCommented:
Right Cayce...
Also any exception raised on debug mode will not be showed at release mode.

gtokas.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now