?
Solved

clearing the stack

Posted on 2002-05-23
2
Medium Priority
?
182 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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

719 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