Board index » delphi » NULL or UNASSIGNED?

NULL or UNASSIGNED?

Hello,

I am using Delphi 4.0 to automate Novell GroupWise via it's COM
automation interface.  I am a little confused as to whether I should be
using NULL or UNASSIGNED to release objects once I'm done with them.  
I've seen examples that appear to use both methods.

For example, I obtain an instance of the GroupWise API object by calling:

objObject:  OleVariant;

objObject := CreateOleObject('NovellGroupWareSession');
.
.
code here
.
.
Do I ensure objObject is properly released by calling:

objObject := NULL
or
objObject := UNASSIGNED

Thanks in advance,

Grant
grant.john...@acslink.aone.net.au

 

Re:NULL or UNASSIGNED?


Hello !
If you want to keep the OLE link i think it is better to used the UNASSIGNED
constant else
use NULL .
Don't forget to free your object :

    objObject.free;

Quote
Grant Johnson wrote:
> Hello,

> I am using Delphi 4.0 to automate Novell GroupWise via it's COM
> automation interface.  I am a little confused as to whether I should be
> using NULL or UNASSIGNED to release objects once I'm done with them.
> I've seen examples that appear to use both methods.

> For example, I obtain an instance of the GroupWise API object by calling:

> objObject:  OleVariant;

> objObject := CreateOleObject('NovellGroupWareSession');
> .
> .
> code here
> .
> .
> Do I ensure objObject is properly released by calling:

> objObject := NULL
> or
> objObject := UNASSIGNED

> Thanks in advance,

> Grant
> grant.john...@acslink.aone.net.au

Re:NULL or UNASSIGNED?


Hello,

Any of them will do.

have fun,
--
Binh Ly
Brickhouse Data Systems, Inc.
http://www.brickhouse.com

Quote
Grant Johnson wrote in message ...
>Hello,

>I am using Delphi 4.0 to automate Novell GroupWise via it's COM
>automation interface.  I am a little confused as to whether I should be
>using NULL or UNASSIGNED to release objects once I'm done with them.
>I've seen examples that appear to use both methods.

>For example, I obtain an instance of the GroupWise API object by calling:

>objObject:  OleVariant;

>objObject := CreateOleObject('NovellGroupWareSession');
>.
>.
>code here
>.
>.
>Do I ensure objObject is properly released by calling:

>objObject := NULL
>or
>objObject := UNASSIGNED

>Thanks in advance,

>Grant
>grant.john...@acslink.aone.net.au

Re:NULL or UNASSIGNED?


The reason any of them do is that COM does reference counting,
so the moment you aren't referencing the object instance it
is released - that's why NULL and UNASSIGNED work fine.

Cheers,
Kevin.

Quote
bly wrote in message <6u1uf3$g...@forums.borland.com>...
>Hello,

>Any of them will do.

>have fun,
>--
>Binh Ly
>Brickhouse Data Systems, Inc.
>http://www.brickhouse.com
>Grant Johnson wrote in message ...
>>Hello,

>>I am using Delphi 4.0 to automate Novell GroupWise via it's COM
>>automation interface.  I am a little confused as to whether I should be
>>using NULL or UNASSIGNED to release objects once I'm done with them.
>>I've seen examples that appear to use both methods.

>>For example, I obtain an instance of the GroupWise API object by calling:

>>objObject:  OleVariant;

>>objObject := CreateOleObject('NovellGroupWareSession');
>>.
>>.
>>code here
>>.
>>.
>>Do I ensure objObject is properly released by calling:

>>objObject := NULL
>>or
>>objObject := UNASSIGNED

>>Thanks in advance,

>>Grant
>>grant.john...@acslink.aone.net.au

Other Threads