本文整理汇总了C#中MS.Win32.UnsafeNativeMethods类的典型用法代码示例。如果您正苦于以下问题:C# UnsafeNativeMethods类的具体用法?C# UnsafeNativeMethods怎么用?C# UnsafeNativeMethods使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnsafeNativeMethods类属于MS.Win32命名空间,在下文中一共展示了UnsafeNativeMethods类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEndEdit
internal void OnEndEdit(
UnsafeNativeMethods.ITfContext context,
int ecReadOnly,
UnsafeNativeMethods.ITfEditRecord editRecord)
{
if (_propertyRanges == null)
{
_propertyRanges = new TextServicesDisplayAttributePropertyRanges(_textstore);
}
_propertyRanges.OnEndEdit(context, ecReadOnly, editRecord);
}
示例2: DynamicScriptObject
internal DynamicScriptObject(UnsafeNativeMethods.IDispatch scriptObject)
{
if (scriptObject == null)
{
throw new ArgumentNullException("scriptObject");
}
_scriptObject = scriptObject;
// In the case of IE, we use IDispatchEx for enhanced security (see InvokeOnScriptObject).
_scriptObjectEx = _scriptObject as UnsafeNativeMethods.IDispatchEx;
}
示例3: OnEndEdit
internal virtual void OnEndEdit(UnsafeNativeMethods.ITfContext context,
int ecReadOnly,
UnsafeNativeMethods.ITfEditRecord editRecord)
{
int fetched;
UnsafeNativeMethods.IEnumTfRanges ranges;
UnsafeNativeMethods.ITfProperty prop = null;
ranges = GetPropertyUpdate(editRecord);
UnsafeNativeMethods.ITfRange [] outRanges;
outRanges = new UnsafeNativeMethods.ITfRange[1];
while (ranges.Next(1, outRanges, out fetched) == 0)
{
//
// check the element has enabled dynamic property.
//
ITextPointer start;
ITextPointer end;
ConvertToTextPosition(outRanges[0], out start, out end);
if (prop == null)
context.GetProperty(ref _guid, out prop);
UnsafeNativeMethods.IEnumTfRanges rangesProp;
if (prop.EnumRanges(ecReadOnly, out rangesProp, outRanges[0]) == 0)
{
UnsafeNativeMethods.ITfRange [] outRangesProp;
outRangesProp = new UnsafeNativeMethods.ITfRange[1];
while (rangesProp.Next(1, outRangesProp, out fetched) == 0)
{
OnRange(prop, ecReadOnly, outRangesProp[0]);
Marshal.ReleaseComObject(outRangesProp[0]);
}
Marshal.ReleaseComObject(rangesProp);
}
Marshal.ReleaseComObject(outRanges[0]);
}
Marshal.ReleaseComObject(ranges);
if (prop != null)
Marshal.ReleaseComObject(prop);
}
示例4: OnRange
internal override void OnRange(
UnsafeNativeMethods.ITfProperty property,
int ecReadOnly,
UnsafeNativeMethods.ITfRange range)
{
Int32 guidatom = GetInt32Value(ecReadOnly, property, range);
if (guidatom != 0)
{
TextServicesDisplayAttribute attr;
attr = GetDisplayAttribute(guidatom);
if (attr != null)
{
ITextPointer start;
ITextPointer end;
ConvertToTextPosition(range, out start, out end);
attr.Apply(start, end);
}
}
}
示例5: OpenColorProfile
internal void OpenColorProfile(ref UnsafeNativeMethods.PROFILE profile)
{
// No need to get rid of the old handle as it will get GC'ed
_profileHandle = UnsafeNativeMethodsMilCoreApi.Mscms.OpenColorProfile(
ref profile,
NativeMethods.PROFILE_READ, // DesiredAccess
NativeMethods.FILE_SHARE_READ, // ShareMode
NativeMethods.OPEN_EXISTING // CreationMode
);
}
示例6: MouseSink
internal MouseSink(UnsafeNativeMethods.ITfRangeACP range, UnsafeNativeMethods.ITfMouseSink sink, int cookie)
{
_range = new SecurityCriticalDataClass<UnsafeNativeMethods.ITfRangeACP>(range);
_sink = new SecurityCriticalDataClass<UnsafeNativeMethods.ITfMouseSink>(sink);
_cookie = cookie;
}
示例7: EnumToolTipWindows
// ------------------------------------------------------
//
// Private Methods
//
// ------------------------------------------------------
#region Private Methods
private static bool EnumToolTipWindows(IntPtr hwnd, ref UnsafeNativeMethods.ENUMTOOLTIPWINDOWINFO lParam)
{
// Use ProxyGetClassName here instead of GetClassName(),
// since for a [....] tooltip the latter will return
// "WindowsForms10.tooltips_class32.app.0.b7ab7b".
// Instead, ProxyGetClassName uses WM_GETOBJECT with
// OBJID_QUERYCLASSNAMEIDX, which will return the correct answer.
if (!ProxyGetClassName(hwnd).Equals("tooltips_class32"))
{
return true;
}
NativeMethods.TOOLINFO tool = new NativeMethods.TOOLINFO();
tool.Init(Marshal.SizeOf(typeof(NativeMethods.TOOLINFO)));
// For tooltips with ids of 0, MFC will create the tooltip with the flag of TTF_IDISHWND.
// TTF_IDISHWND indicates that the uId member is the window handle to the tool.
if (lParam.id == 0)
{
tool.hwnd = Misc.GetParent(lParam.hwnd);
tool.uId = unchecked((int)lParam.hwnd);
tool.uFlags = NativeMethods.TTF_IDISHWND;
}
else
{
tool.hwnd = lParam.hwnd;
tool.uId = lParam.id;
}
string name = XSendMessage.GetItemText(hwnd, tool);
// Didn't get anything - continue looking...
if (string.IsNullOrEmpty(name))
{
return true;
}
lParam.name = name;
// Got it - can stop iterating now.
return false;
}
示例8: ProxyGetTitleBarInfo
// wrapper for GetTitleBarInfo
internal static bool ProxyGetTitleBarInfo(IntPtr hwnd, out UnsafeNativeMethods.TITLEBARINFO ti)
{
ti = new UnsafeNativeMethods.TITLEBARINFO();
ti.cbSize = Marshal.SizeOf(ti.GetType());
bool result = UnsafeNativeMethods.GetTitleBarInfo(hwnd, ref ti);
int lastWin32Error = Marshal.GetLastWin32Error();
if (!result)
{
ThrowWin32ExceptionsIfError(lastWin32Error);
return false;
}
return true;
}
示例9: GetInt32Value
private Int32 GetInt32Value(int ecReadOnly, UnsafeNativeMethods.ITfProperty property, UnsafeNativeMethods.ITfRange range)
{
Object obj = GetValue(ecReadOnly, property, range);
if (obj == null)
return 0;
return (Int32)obj;
}
示例10: DoDragDrop
public static extern void DoDragDrop(IComDataObject dataObject, UnsafeNativeMethods.IOleDropSource dropSource, int allowedEffects, int[] finalEffect);
示例11:
int UnsafeNativeMethods.IDocHostUIHandler.GetDropTarget(UnsafeNativeMethods.IOleDropTarget pDropTarget, out UnsafeNativeMethods.IOleDropTarget ppDropTarget)
{
//
// Set to null no matter what we return, to prevent the marshaller
// from going crazy if the pointer points to random stuff.
ppDropTarget = null;
return NativeMethods.E_NOTIMPL;
}
示例12: RequestAttrsTransitioningAtPosition
// See msdn's ITextStoreACP documentation for a full description.
public void RequestAttrsTransitioningAtPosition(int position, int count, Guid[] filterAttributes, UnsafeNativeMethods.AttributeFlags flags)
{
throw new COMException(SR.Get(SRID.TextStore_E_NOTIMPL), unchecked((int)0x80004001));
}
示例13: RequestAttrsAtPosition
// See msdn's ITextStoreACP documentation for a full description.
public int RequestAttrsAtPosition(int index, int count, Guid[] filterAttributes, UnsafeNativeMethods.AttributeFlags flags)
{
ITextPointer position;
position = CreatePointerAtCharOffset(index, LogicalDirection.Forward);
PrepareAttributes((InputScope)position.GetValue(InputMethod.InputScopeProperty),
(double)position.GetValue(TextElement.FontSizeProperty),
(FontFamily)position.GetValue(TextElement.FontFamilyProperty),
(XmlLanguage)position.GetValue(FrameworkContentElement.LanguageProperty),
null,
count, filterAttributes);
if (_preparedattributes.Count == 0)
return NativeMethods.S_FALSE;
return NativeMethods.S_OK;
}
示例14: RequestSupportedAttrs
// See msdn's ITextStoreACP documentation for a full description.
public int RequestSupportedAttrs(UnsafeNativeMethods.AttributeFlags flags, int count, Guid[] filterAttributes)
{
// return the default app property value, which target is Scope.
PrepareAttributes((InputScope)UiScope.GetValue(InputMethod.InputScopeProperty),
(double)UiScope.GetValue(TextElement.FontSizeProperty),
(FontFamily)UiScope.GetValue(TextElement.FontFamilyProperty),
(XmlLanguage)UiScope.GetValue(FrameworkContentElement.LanguageProperty),
UiScope as Visual,
count, filterAttributes);
if (_preparedattributes.Count == 0)
return NativeMethods.S_FALSE;
return NativeMethods.S_OK;
}
示例15: InsertEmbeddedAtSelection
// See msdn's ITextStoreACP documentation for a full description.
public void InsertEmbeddedAtSelection(UnsafeNativeMethods.InsertAtSelectionFlags flags, object obj, out int startIndex, out int endIndex, out UnsafeNativeMethods.TS_TEXTCHANGE change)
{
startIndex = -1;
endIndex = -1;
change.start = 0;
change.oldEnd = 0;
change.newEnd = 0;
if (IsReadOnly)
{
throw new COMException(SR.Get(SRID.TextStore_TS_E_READONLY), UnsafeNativeMethods.TS_E_READONLY);
}
#if ENABLE_INK_EMBEDDING
IComDataObject data;
if (IsReadOnly)
{
throw new COMException(SR.Get(SRID.TextStore_TS_E_READONLY), UnsafeNativeMethods.TS_E_READONLY);
}
if (!TextSelection.HasConcreteTextContainer)
{
throw new COMException(SR.Get(SRID.TextStore_TS_E_FORMAT), UnsafeNativeMethods.TS_E_FORMAT);
}
// The object must have IOldDataObject internface.
// The obj param of InsertEmbedded is IDataObject in Win32 definition.
data = obj as IComDataObject;
if (data == null)
{
throw new COMException(SR.Get(SRID.TextStore_BadObject), NativeMethods.E_INVALIDARG);
}
// Do the insert.
if ((flags & UnsafeNativeMethods.InsertAtSelectionFlags.TS_IAS_QUERYONLY) == 0)
{
InsertEmbeddedAtRange((TextPointer)this.TextSelection.Start, (TextPointer)this.TextSelection.End, data, out change);
}
if ((flags & UnsafeNativeMethods.InsertAtSelectionFlags.TS_IAS_NOQUERY) == 0)
{
startIndex = this.TextSelection.Start.Offset;
endIndex = this.TextSelection.End.Offset;
}
#else
throw new COMException(SR.Get(SRID.TextStore_TS_E_FORMAT), UnsafeNativeMethods.TS_E_FORMAT);
#endif
}