How to destroy activex component that is generating error in delphi?

1

I'm using an Adobe PDF ActiveX component (TAcroPDF), it works fine, it happens when you close the form with the proper Release lines; FreeAndNil (TForm); in OnClose, it still generates an error when closing, it seems to me that it does not release the TAcroPDF component from memory because in hundreds of other Forms in the application this is the only one that has this component and generates the error, when removing the component it normal date.

I tried giving a FreeAndNil (AcroPDF1); but it generates error when trying to destroy.

I have tried numerous ways to destroy the form and PDF object but without success, so I came to my colleagues to see if anyone can give some idea of what else I can do.

    
asked by anonymous 06.03.2018 / 15:52

2 answers

2

The answer to your question has already been answered. See link to response.
Error closing form with TAcroPDF in Delphi

    
29.03.2018 / 15:58
1

Try to do this:

if(assigned(AcroPDF1)then 
  freeandNil(AcroPDF1)

or

if(AcroPDF1 = nil)then 
      freeandNil(AcroPDF1)

Assigned tests if the component is created, if it is instantiated. It may be that the component is already depleted, or is in use and destroying the error.

    
06.03.2018 / 16:05