Hi, thank you for your help. But the problem comes from the following code: SafeArrayCreateVector(VT_DISPATCH, 0, length);. If I hide this code, no problem any more. If the code is SafeArrayCreateVector(VT_INT, 0, length); or SafeArrayCreateVector(VT_BSTR, 0, length);.., no problem. So eventhough I wrap the return value into VARIANT type, I still have to call SafeArrayCreateVector(VT_DISPATCH, 0, length);, then the problem is still there. Do you know how to solve it, or is there any other ways to create a vector of IDispatch*? Thank you. Nga