Solved

clearing the stack

Posted on 2002-05-23
2
173 Views
Last Modified: 2010-04-04
Hi...
  I have an "error-checking" type of procedure I made in my app that checks for bad input records. If a bad record is found, I want my app to go back to "square one" and re-initialize everything to have the user start again. Basically, in this "error-checking" procedure of mine, I want to be able to also clear out the stack of previous procedure calls, etc, so my app is a totally clean slate when I put the user back to the start.

Is there any way to programmatically do this? I'm using D3 Professional.

Thanks
   Shawn
0
Comment
Question by:aztec
2 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
ID: 7031204
I would suggest restarting the application completely by using these 2 lines of code:

WinExec(pchar(ParamStr(0), WM_SHOWNORMAL);
ExitProcess(0);

Regards, Madshi.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 7031390
Hi aztec,

I think you can use Exception to return control to top level procedure that able to handle exception. e.g:

procedure Proc1;
begin
  if condition then
    Exception.Create('error!')
  else
  ....
end;

procedure Porc2;
begin
  Proc1;
  ....;
end

procedure Proc3;
begin
  Proc2;
  ...
end;

procedure  Main;
begin
  try
    Proc3;
    ShowMessage('executed OK')
  except
    ShowMessage('Error!')
  end;
end;


--------
Igor
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

19 Experts available now in Live!

Get 1:1 Help Now