>>Hello all,
>>
>>I execute this code. First time I execute everything's fine. Second time my application hangs and I have to reboot my computer. I guess that there could be something related to outlook still in memory. But I don't understand.
>>
>>
>>
>>lContinue = .F.
>>
>>oOutlook = CREATEOBJECT("Outlook.Application")
>>outlookAccounts = oOutlook.GetNamespace("MAPI").Accounts
>>FOR i = 1 TO outlookAccounts.Count
>> IF outlookAccounts.Item(i).DisplayName = "myemail@mycompany.com" THEN
>> lContinue = .T.
>> EXIT
>> ENDIF
>>ENDFOR
>>oOutlook = null
>>outlookAccounts = null
>>
>>IF !lContinue
>> Messagebox( "You can't use that application.")
>> QUIT
>>ENDIF
>>
>
>You must release the variables in reverse order.
>It's also recommended to use Release to absolutely make sure that the variables are released.
>IOW
>
>
outlookAccounts = null
>outlook = null
>release outlookAccounts
>release outlook
>
This can get unwieldy if lots of pointers are added or app grows
First step for automatic management is to create a class
sporting an array of names / pointer descriptors (not pointers)
and increment length of array with new pointer descriptor
whenever a new special (COM, Base Mem, Dotnet) pointer is added
and reference it there.
Release just walks this array from top to bottom.
Use recursively if you have "pointer groups" like in the example
*and* a need to free those special groups before form or app quit.
my 0.0022€
thomas