Solved

clearing the stack

Posted on 2002-05-23
2
177 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 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