Esempio n. 1
0
        public StringSource(string[] strings)
        {
            Array.Clear(strings, 0, size);

            if (strings is not null)
            {
                this.strings = strings;
            }

            current = 0;
            size    = (strings is null) ? 0 : strings.Length;

            Guid    iid_iunknown = typeof(Shell32.IAutoComplete2).GUID;
            HRESULT hr           = Ole32.CoCreateInstance(
                ref autoCompleteClsid,
                IntPtr.Zero,
                Ole32.CLSCTX.INPROC_SERVER,
                ref iid_iunknown,
                out object obj);

            if (!hr.Succeeded())
            {
                throw Marshal.GetExceptionForHR((int)hr);
            }

            _autoCompleteObject2 = (Shell32.IAutoComplete2)obj;
        }
Esempio n. 2
0
 public void ReleaseAutoComplete()
 {
     if (_autoCompleteObject2 is not null)
     {
         Marshal.ReleaseComObject(_autoCompleteObject2);
         _autoCompleteObject2 = null;
     }
 }