Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Mobile 6 - Disable AutoComplete on WinForms TextBoxes

I am making a windows mobile 6 app, where I need to disable autocomplete on the textboxes that I have on my form. Information is being scanned into them, therefore I need to disable the autocomplete/autosuggest feature. Can I do this programmatically or do I need to manipulate registry keys? (This is not a commercial application.)

like image 437
Harvey Avatar asked Nov 30 '22 05:11

Harvey


1 Answers

Use this class, it will pinvoke the SHSetInputContext method and disable\enable the hover over events for the controls. Simply pass the controls Handle.

public static class InputContext
{
    private enum SHIC_FEATURE : uint
    {
        RESTOREDEFAULT = 0,
        AUTOCORRECT = 1,
        AUTOSUGGEST = 2,
        HAVETRAILER = 3,
        CLASS = 4
    }

    [DllImport("aygshell.dll")]
    private static extern int SHSetInputContext(IntPtr hwnd, SHIC_FEATURE dwFeature, ref bool lpValue);

    public static void SetAutoSuggestion(IntPtr handle, bool enable)
    {
        SHSetInputContext(handle, SHIC_FEATURE.AUTOSUGGEST, ref enable);
        SHSetInputContext(handle, SHIC_FEATURE.AUTOCORRECT, ref enable);
    }
}

Example:

InputContext.SetAutoSuggestion(txtBoxOne.Handle, false);
like image 125
sharky101 Avatar answered Dec 10 '22 01:12

sharky101