本文整理汇总了C#中MS.Win32.UnsafeNativeMethods.QueryRange方法的典型用法代码示例。如果您正苦于以下问题:C# UnsafeNativeMethods.QueryRange方法的具体用法?C# UnsafeNativeMethods.QueryRange怎么用?C# UnsafeNativeMethods.QueryRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS.Win32.UnsafeNativeMethods
的用法示例。
在下文中一共展示了UnsafeNativeMethods.QueryRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFnReconv
private bool GetFnReconv(ITextPointer textStart, ITextPointer textEnd, out UnsafeNativeMethods.ITfFnReconversion funcReconv, out UnsafeNativeMethods.ITfRange rangeNew)
{
UnsafeNativeMethods.ITfContext context;
UnsafeNativeMethods.ITfRange range;
UnsafeNativeMethods.ITfRangeACP rangeACP;
bool fReconvertable = false;
funcReconv = null;
rangeNew = null;
// Create ITfRangeACP for the current selection.
// 1. Get the context from the document manager and call GetStart to get the instance of
// ITfRange.
// 2. QI the ITfRange to get ITfRangeACP.
// 3. Get start and end of the current selection from TextContainer.
// 4. Set extent of the ITfRangeACP.
DocumentManager.GetBase(out context);
context.GetStart(EditCookie, out range);
rangeACP = range as UnsafeNativeMethods.ITfRangeACP;
int start = textStart.CharOffset;
int end = textEnd.CharOffset;
rangeACP.SetExtent(start, end - start);
// Readonly fields can not be passed ref to the interface methods.
// Create pads for them.
Guid guidSysFunc = UnsafeNativeMethods.GUID_SYSTEM_FUNCTIONPROVIDER;
Guid guidNull = UnsafeNativeMethods.Guid_Null;
Guid iidFnReconv = UnsafeNativeMethods.IID_ITfFnReconversion;
UnsafeNativeMethods.ITfFunctionProvider functionPrv;
// ThreadMgr Method call will be marshalled to the dispatcher thread since Ciecro is STA.
_textservicesHost.ThreadManager.GetFunctionProvider(ref guidSysFunc, out functionPrv);
object obj;
// ITfFnReconversion is always available in SystemFunctionProvider.
functionPrv.GetFunction(ref guidNull, ref iidFnReconv, out obj);
funcReconv = obj as UnsafeNativeMethods.ITfFnReconversion;
funcReconv.QueryRange(range, out rangeNew, out fReconvertable);
// release objects.
Marshal.ReleaseComObject(functionPrv);
if (!fReconvertable)
{
Marshal.ReleaseComObject(funcReconv);
funcReconv = null;
}
Marshal.ReleaseComObject(range);
Marshal.ReleaseComObject(context);
return fReconvertable;
}