IAutoComplete2 (Interfaces)
Last changed: -217.85.252.206

.
Summary
A little bit more advanced autocomplete

C# Definition:

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("EAC04BC0-3791-11D2-BB95-0060977B464C")]
public interface IAutoComplete2 {
    [PreserveSig] int Init(
        // Handle to the window for the system edit control that is to
        // have autocompletion enabled.
        IntPtr hwndEdit,

        // Pointer to the IUnknown interface of the string list object that
        // is responsible for generating candidates for the completed
        // string. The object must expose an IEnumString interface.
        [MarshalAs(UnmanagedType.IUnknown)] object punkACL,

        // Pointer to an optional null-terminated Unicode string that gives
        // the registry path, including the value name, where the format
        // string is stored as a REG_SZ value. The autocomplete object
        // first looks for the path under HKEY_CURRENT_USER . If it fails,
        // it then tries HKEY_LOCAL_MACHINE . For a discussion of the
        // format string, see the definition of pwszQuickComplete.
        [MarshalAs(UnmanagedType.LPWStr)] string pwszRegKeyPath,

        // Pointer to an optional string that specifies the format to be
        // used if the user enters some text and presses CTRL+ENTER. Set
        // this parameter to NULL to disable quick completion. Otherwise,
        // the autocomplete object treats pwszQuickComplete as a sprintf
        // format string, and the text in the edit box as its associated
        // argument, to produce a new string. For example, set
        // pwszQuickComplete to "http://www. %s.com/". When a user enters
        // "MyURL" into the edit box and presses CTRL+ENTER, the text in
        // the edit box is updated to "http://www.MyURL.com/".
        [MarshalAs(UnmanagedType.LPWStr)] string pwszQuickComplete
    );

    // Enables or disables autocompletion.
    [PreserveSig] int Enable(bool value);

    // Sets the current autocomplete options.
    [PreserveSig] int SetOptions(AUTOCOMPLETEOPTIONS dwFlag);

    // Retrieves the current autocomplete options.
    [PreserveSig] int GetOptions(out AUTOCOMPLETEOPTIONS pdwFlag);
}

User-Defined Types:

AUTOCOMPLETEOPTIONS is a handy enum for interpreting the values used by the GetOptions/SetOptions methods.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

static readonly Guid CLSID_AutoComplete = new Guid("{00BB2763-6A77-11D0-A535-00C04FD7D062}");

private IAutoComplete2 GetAutoComplete() {
    Type CAutoComplete = Type.GetTypeFromCLSID(CLSID_AutoComplete);

    return (IAutoComplete2)Activator.CreateInstance(CAutoComplete);
}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation