Board index » delphi » Raise Exception.

Raise Exception.

Hello!
I have a problem with my program, it has a lot of forms and I don't know if
may be the reason or is another reason because it fails.
The fact is when I close my application it raises an exception and gives
"Access Violation" and after always gives the same memory address "0000004"
or something like that.
?What can I do for avoid this message? ?Have I to load something in a
splicit memory area? ?How can I do it?
P.D. I'm Rookie.

Thanx in advance.

 

Re:Raise Exception.


On Mon, 14 May 2001 17:38:08 +0200, "Mario Furi"

Quote
<mario...@teleline.es> wrote:
>Hello!
>I have a problem with my program, it has a lot of forms and I don't know if
>may be the reason or is another reason because it fails.
>The fact is when I close my application it raises an exception and gives
>"Access Violation" and after always gives the same memory address "0000004"
>or something like that.
>?What can I do for avoid this message? ?Have I to load something in a
>splicit memory area?
.....No
>How can I do it?
>P.D. I'm Rookie.

You probably are referring to something in some form after that form
has been destroyed. You can put a breakpoint in the event that starts
closing your application. Then step through the closing process to see
where the exception occurs.

HTH,
Dan
--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com
[SPAM block: change at to @ in my e-mail address]

Re:Raise Exception.


On Mon, 14 May 2001 17:38:08 +0200, "Mario Furi"

Quote
<mario...@teleline.es> wrote:
>Hello!
>I have a problem with my program, it has a lot of forms and I don't know if
>may be the reason or is another reason because it fails.
>The fact is when I close my application it raises an exception and gives
>"Access Violation" and after always gives the same memory address "0000004"
>or something like that.
>?What can I do for avoid this message? ?Have I to load something in a
>splicit memory area? ?How can I do it?
>P.D. I'm Rookie.

>Thanx in advance.

Access violation mean s you have attempted to access memory that
you're not allowed to. Either you have destroyed (or freed) the form,
then tried to access it again, or it wasn't destroyed properly in the
first place.

I tend to set the close Action of forms to caFree ie

procedure TForm1.FormClose(Whatever the parameters are; Action :
TCloseAction);
begin
        Action := caFree;
end;

This works so long as you don't need to access any properties of the
form after you close it. If you need to do that I my calling method
looks like:

Application.CreateForm(TForm1, fmForm1);
fmForm1.ShowModal; // assuming its a modal form
blah, blah blah

fmForm1.Release;

fmForm1's Close method must NOT have caFree, else you will free the
form on closing it, and then try to free the form again when you
release it. To make the form disappear from the screen when you close
it use

Action := caHide

in fmForm1's Close method.

Hope this helps,

Richard

Other Threads