Do not call _addref or _release unless you know exactly what you are doing
(ie you are making another copy of a object reference or doing some nasty
type casting). 

Delphi does all the reference counting for you - it will call _addref and
_release by itself, if you call it again things will go wrong like you
mention.

If you want to release a interface explicitly then "IMyInterfaceRef := nil;"
should be used to achieve this - there is no real point to this as Delphi
will clean up after you anyway.

Myles.



-----Original Message-----
From: David Smith [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 13 November 2001 4:18 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: ADSI and Delphi


Hi Stacy,

Thanks for your response.  We're using Delphi 5 and also the helper routines
you mention.

Very bizarre error. If we remove some very basic logging routines the error
goes away, which seems to indicate that it is a timing issue. Almost 100%
certain it's not the logging code as all it does is write TStringList log
file to disk.

Are you doing anything special with _addRef, _release, coinitialize and
counintialize?  Playing with these functions seems to move the error around.

Any info would be greatly appreciated.

Thanks,
David.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Stacey Verner
Sent: Tuesday, 13 November 2001 13:01 PM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: ADSI and Delphi


We use ADSI with delphi and don't have the problems you mentioned. It works
with Delphi 4 and Delphi 6.
We have created a DLL (in Delphi) that is used by Delphi, Access and VB and
it uses ADSI.

We use some ADSI helper routines
(http://www.agnisoft.com/adsi/Conf2000/3132.htm) which may help.

Stacey

> -----Original Message-----
> From: David Smith [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 13 November 2001 3:51 p.m.
> To: Multiple recipients of list delphi
> Subject: [DUG]: ADSI and Delphi
>
>
> Hi All,
>
> Has anyone had any experience with using ADSI from Delphi.  We are
> successfully creating a user but then a EAccessViolation\EPrivilege
> exception is raised.  The exception does not correspond to
> any line of code
> and comes up in the CPU debugger.  We have tried all sorts of
> things but
> have had no luck.  We are calling the ADSI interface from a
> dll as it's
> going to form part of an install.
>
> Will be quite happy to send over code examples if anyone is
> interested.
>
> Thanks,
> David.
>
>
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to