Solved

clearing the stack

Posted on 2002-05-23
2
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

751 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