Hello, i'm some kind of new in com, i understand very well the model and have done some code using com interfaces, but i have some questions about it, that i would like to resolve:
1) Have i to call every time i discard an interface at the method Release?
for example if i have an inteface of one object and i call to the QueryInterface and get other interface of the same object, should i call twice to the method Release over each interface? i think yes, but i see some code that didnt do it and i get confuse...

2)This is more important, i read the especification of the interfaces of one library that was include in the resource section of the library, and there was some methods that have as parameter a variant, like this:
function item(out name: Variant; out index: Variant): IDispatch; stdcall;
i know that the variants are not passed by reference because when this happens the method is descripted like this:
function addBehavior(bstrUrl: BSTR; out pvarFactory: ^Variant): I4; stdcall;
and the parameter is descripted like "^Variant" representhing a pointer or a reference to the variant.
when the parameter is not descripted as a pointer, like in the first case, should i put all the structure of the variant in the stack??if someone can answer this it would be very helpfull, because is my main trouble with variants
3)Another unsolved problem, when i call an method and this return me a pointer to a variant, shoud i release the merory of the variant?? or this will be release by the object who has reserved previously???

that is all for now with com and variants, and if U help me i promise U i will draw more problems to this board....


_______________________Mauricio Prado
sorry if my english is not too readable....
Posted on 2004-11-12 20:13:46 by mauricioprado
to 1.: yes
to 2.: yes, push 16 bytes for a variant parameter
to 3.: you should free the variant by calling VariantClear
Posted on 2004-11-13 03:18:55 by japheth