Solved

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

Posted on 2004-10-07
2
660 Views
Last Modified: 2013-11-17
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
Comment
Question by:stimmis
2 Comments
 
LVL 9

Accepted Solution

by:
Cayce earned 500 total points
ID: 12254985
Application->Terminate() should do fine.

If it doesn't on your application then you need to close a couple forms before terminating.
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 12257268
Right Cayce...
Also any exception raised on debug mode will not be showed at release mode.

gtokas.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now