Exemple #1
0
            /// <summary>
            /// Get the <paramref name="size"/> and <paramref name="data"/> of the corresponding <paramref name="compositionString"/> from the IMM.
            /// </summary>
            /// <remarks>
            /// The <paramref name="size"/> and <paramref name="data"/> have different meanings, depending on the provided <paramref name="compositionString"/>:
            ///   <list type="bullet">
            ///     <item>For <see cref="CompositionString.GCS_COMPSTR"/> and <see cref="CompositionString.GCS_RESULTSTR"/> data is UTF-16 encoded text.</item>
            ///     <item>For <see cref="CompositionString.GCS_COMPATTR"/> .</item>
            ///   </list>
            /// </remarks>
            private bool tryGetCompositionString(CompositionString compositionString, out int size, out byte[] data)
            {
                data = null;

                if (!tryGetCompositionSize(compositionString, out size))
                {
                    return(false);
                }

                data = new byte[size];
                int ret = ImmGetCompositionString(handle, compositionString, data, (uint)size);

                // negative return value means that an error has occured.
                return(ret >= 0);
            }
Exemple #2
0
 public InputContext(IntPtr hWnd, long lParam = 0)
 {
     handle      = new InputContextHandle(hWnd);
     this.lParam = (CompositionString)lParam;
 }
Exemple #3
0
 private bool tryGetCompositionText(CompositionString compositionString, out string text)
 {
     if (tryGetCompositionString(compositionString, out _, out byte[] buffer))