コード例 #1
0
        void ComTypes.ITypeLib.GetDocumentation(int memid, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile)
        {
            // initialize out parameters
            strName       = default;
            strDocString  = default;
            dwHelpContext = default;
            strHelpFile   = default;

            using (var _name = AddressableVariables.CreateBSTR())
                using (var _docString = AddressableVariables.CreateBSTR())
                    using (var _helpContext = AddressableVariables.Create <int>())
                        using (var _Helpfile = AddressableVariables.CreateBSTR())
                        {
                            int hr = _this_Internal.GetDocumentation(memid, _name.Address, _docString.Address, _helpContext.Address, _Helpfile.Address);
                            if (ComHelper.HRESULT_FAILED(hr))
                            {
                                HandleBadHRESULT(hr);
                            }

                            strName       = _name.Value;
                            strDocString  = _docString.Value;
                            dwHelpContext = _helpContext.Value;
                            strHelpFile   = _Helpfile.Value;
                        }
        }
コード例 #2
0
 void ComTypes.ITypeInfo.GetIDsOfNames(string[] rgszNames, int cNames, int[] pMemId)
 {
     // We can't use the managed arrays as passed in.  We create our own unmanaged arrays,
     // and copy them into the managed ones on completion
     using (var names = AddressableVariables.CreateBSTR(cNames))
         using (var memberIds = AddressableVariables.Create <int>(cNames))
         {
             var hr = _this_Internal.GetIDsOfNames(names.Address, cNames, memberIds.Address);
             if (ComHelper.HRESULT_FAILED(hr))
             {
                 HandleBadHRESULT(hr);
             }
             names.CopyArrayTo(rgszNames);
             memberIds.CopyArrayTo(pMemId);
         }
 }
コード例 #3
0
        void ComTypes.ITypeInfo.GetMops(int memid, out string pBstrMops)
        {
            // initialize out parameters
            pBstrMops = default;

            using (var strMops = AddressableVariables.CreateBSTR())
            {
                var hr = _this_Internal.GetMops(memid, strMops.Address);
                if (ComHelper.HRESULT_FAILED(hr))
                {
                    HandleBadHRESULT(hr);
                }

                pBstrMops = strMops.Value;
            }
        }
コード例 #4
0
        void ComTypes.ITypeInfo.GetNames(int memid, string[] rgBstrNames, int cMaxNames, out int pcNames)
        {
            // initialize out parameters
            pcNames = default;

            using (var names = AddressableVariables.CreateBSTR(cMaxNames))
                using (var namesCount = AddressableVariables.Create <int>())
                {
                    var hr = _this_Internal.GetNames(memid, names.Address, cMaxNames, namesCount.Address);
                    if (ComHelper.HRESULT_FAILED(hr))
                    {
                        HandleBadHRESULT(hr);
                    }
                    names.CopyArrayTo(rgBstrNames);
                    pcNames = namesCount.Value;
                }
        }