Exemplo n.º 1
0
        public unsafe void ITypeInfo_GetNames_Invoke_Success()
        {
            using var image = new Bitmap(16, 32);
            IPictureDisp picture  = SubAxHost.GetIPictureDispFromPicture(image);
            IDispatch    dispatch = (IDispatch)picture;
            ITypeInfo    typeInfo;
            HRESULT      hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo);

            Assert.Equal(HRESULT.S_OK, hr);

            BSTR *rgszNames = stackalloc BSTR[2];

            rgszNames[0] = new BSTR("Name1");
            rgszNames[1] = new BSTR("Name2");
            uint cNames = 0;

            hr = typeInfo.GetNames((DispatchID)4, rgszNames, 2u, &cNames);
            Assert.Equal(HRESULT.S_OK, hr);
            Assert.Equal("Width", rgszNames[0].String.ToString());
            Assert.Equal("Name2", rgszNames[1].String.ToString());
            Assert.Equal(1u, cNames);

            rgszNames[0].Dispose();
            rgszNames[1].Dispose();
        }
 virtual HRESULT STDMETHODCALLTYPE GetHelpFile(
     /* [out] */ BSTR *pBstrHelpFile) = 0;
 virtual HRESULT STDMETHODCALLTYPE GetDescription(
     /* [out] */ BSTR *pBstrDescription) = 0;
 virtual HRESULT STDMETHODCALLTYPE GetSource(
     /* [out] */ BSTR *pBstrSource) = 0;