Solved

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

Posted on 2004-10-07
2
662 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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: …
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.

773 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