0
초보자로서 COM 개념을 배우는 것은 매우 어렵습니다. 다음 오류를 설명해주십시오. 다음과 같은 함수 본문이있는 com 코드가있는 이유는 무엇입니까?COM 함수는 E_POINTER를 반환합니다
STDMETHODIMP CCollectionBase::put_InputCollectionInterface(
IUnknown *InputTagInterface)
{
ICollection* inputCollectionInterface;
HRESULT hr = QueryInterface(__uuidof(ICollection),
(void**)&inputCollectionInterface);
if (FAILED(hr)) return hr;
//m_inputCollectionInterface is global variable of ICollection
m_inputCollectionInterface = inputCollectionInterface;
return S_OK;
}
그리고 다음과 같은 방법으로 함수를 호출하고 있습니다.
ITag* inputTagInterface;
//InternalCollection is ICollectionBase object
hr = InternalCollection->put_InputCollectionInterface(inputTagInterface);
그러나 얻을 수있는 시간은 E_POINTER
입니다. 왜 E_POINTER
일까요?
운이 좋으면'E_POINTER'가됩니다. 'inputTagInterface'는 초기화되지 않은 포인터 변수입니다. 이것은 COM과 전혀 관련이 없습니다. 이것은 매우 기본적인 C++입니다. COM은 오류 코드를 반환합니다 (가능한 경우). C++이 충돌합니다 (그렇지 않은 경우 제외). – IInspectable
답장을 보내 주셔서 감사합니다 @IInspectable 내가 전달하는 매개 변수가 초기화되지 않는다는 것을 의미합니까? –
@IInspectable 어떻게 매개 변수를 초기화 하시겠습니까? –