Solved

clearing the stack

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ddeman not working in activex 3 103
Multiple image collision 13 75
Why can't I create any project with my delphi EXE file? 6 26
how can i search if string exist in array ? 3 58
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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

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