本文整理汇总了C#中UnsafeNativeMethods类的典型用法代码示例。如果您正苦于以下问题:C# UnsafeNativeMethods类的具体用法?C# UnsafeNativeMethods怎么用?C# UnsafeNativeMethods使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnsafeNativeMethods类属于命名空间,在下文中一共展示了UnsafeNativeMethods类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnumUnknown
int UnsafeNativeMethods.IOleContainer.EnumObjects(int grfFlags, out UnsafeNativeMethods.IEnumUnknown ppenum)
{
ppenum = null;
Debug.Assert(_host != null, "gotta have the avalon activex host");
object ax = _host.ActiveXInstance;
//We support only one control, return that here
//How does one add multiple controls to a container?
if (ax != null
&&
( ((grfFlags & NativeMethods.OLECONTF_EMBEDDINGS) != 0)
||
((grfFlags & NativeMethods.OLECONTF_ONLYIFRUNNING) != 0 &&
_host.ActiveXState == ActiveXHelper.ActiveXState.Running )) )
{
Object[] temp = new Object[1];
temp[0]= ax;
ppenum = new EnumUnknown(temp);
return NativeMethods.S_OK;
}
ppenum = new EnumUnknown(null);
return NativeMethods.S_OK;
}
示例2: HtmlWindow
internal HtmlWindow(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLWindow2 win)
{
this.htmlWindow2 = win;
Debug.Assert(this.NativeHtmlWindow != null, "The window object should implement IHTMLWindow2");
this.shimManager = shimManager;
}
示例3: GetDropTarget
public int GetDropTarget(
UnsafeNativeMethods.IOleDropTarget pDropTarget,
out UnsafeNativeMethods.IOleDropTarget ppDropTarget)
{
// no additional drop target
ppDropTarget = pDropTarget;
return NativeMethods.SRESULTS.S_FALSE;
}
示例4: HtmlDocument
internal HtmlDocument(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLDocument doc)
{
this.htmlDocument2 = (UnsafeNativeMethods.IHTMLDocument2)doc;
Debug.Assert(this.NativeHtmlDocument2 != null, "The document should implement IHtmlDocument2");
this.shimManager = shimManager;
}
示例5: HtmlElement
internal HtmlElement(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLElement element)
{
this.htmlElement = element;
Debug.Assert(this.NativeHtmlElement != null, "The element object should implement IHTMLElement");
this.shimManager = shimManager;
}
示例6: GetStringHelper
string GetStringHelper(UnsafeNativeMethods.ArgsGetLineStringConsts which)
{
IntPtr ptr_const_this = ConstPointer();
using (var sh = new StringHolder())
{
IntPtr ptr_string = sh.NonConstPointer();
UnsafeNativeMethods.CArgsRhinoGetLine_GetString(ptr_const_this, which, ptr_string);
return sh.ToString();
}
}
示例7: EvtSeek
public static void EvtSeek(
EventLogHandle resultSet,
long position,
EventLogHandle bookmark,
int timeout,
UnsafeNativeMethods.EvtSeekFlags flags) {
bool status = UnsafeNativeMethods.EvtSeek(resultSet, position, bookmark, timeout, flags);
int win32Error = Marshal.GetLastWin32Error();
if (!status)
EventLogException.Throw(win32Error);
}
示例8: Remove
/// <summary>
/// Called when removing a delegate from an event, see the
/// GroundPlane.Changed event for an example.
/// </summary>
/// <param name="type">
/// The event watcher type index
/// </param>
/// <param name="value">
/// Delegate to remove
/// </param>
public static void Remove(UnsafeNativeMethods.EventSyncDocumentSettingsChangedFlag type, EventHandler<RenderPropertyChangedEvent> value)
{
// Remove from the dictionary
if (g_event_dictionary.ContainsKey(type)) g_event_dictionary[type] -= value;
// If there are still event hooks set then bail
if (!IsEmpty) return;
// There are no event hooks set so call into rhcmnrdk_c to set the
// callback hook to null.
UnsafeNativeMethods.CRdkCmnEventWatcher_SetDocumentSettingsChangedEventCallback(null, Rhino.Runtime.HostUtils.m_rdk_ew_report);
g_settings_changed_hook = null;
}
示例9: ArrayList
int UnsafeNativeMethods.IOleContainer.EnumObjects(int grfFlags, out UnsafeNativeMethods.IEnumUnknown ppenum) {
ppenum = null;
if ((grfFlags & 1) != 0) { // 1 == OLECONTF_EMBEDDINGS
Debug.Assert(parent != null, "gotta have it...");
ArrayList list = new ArrayList();
ListAXControls(list, true);
if (list.Count > 0) {
Object[] temp = new Object[list.Count];
list.CopyTo(temp, 0);
ppenum = new AxHost.EnumUnknown(temp);
return NativeMethods.S_OK;
}
}
ppenum = new AxHost.EnumUnknown(null);
return NativeMethods.S_OK;
}
示例10: Add
/// <summary>
/// Called when adding a delegate to a event, see the GroundPlane.Changed
/// event for an example.
/// </summary>
/// <param name="type">
/// The event watcher type index
/// </param>
/// <param name="value">
/// Delegate to add
/// </param>
public static void Add(UnsafeNativeMethods.EventSyncDocumentSettingsChangedFlag type, EventHandler<RenderPropertyChangedEvent> value)
{
// If the callback hook has not been set then set it now
if (g_settings_changed_hook == null)
{
// Call into rhcmnrdk_c to set the callback hook
g_settings_changed_hook = OnSettingsChanged;
UnsafeNativeMethods.CRdkCmnEventWatcher_SetDocumentSettingsChangedEventCallback(g_settings_changed_hook, Rhino.Runtime.HostUtils.m_rdk_ew_report);
}
if (!g_event_dictionary.ContainsKey(type))
g_event_dictionary.Add(type, null);
// Need to do this to ensure the delegate does not get added twice
g_event_dictionary[type] -= value;
// Add the new delegate to the event list
g_event_dictionary[type] += value;
}
示例11:
int UnsafeNativeMethods.IOleClientSite.GetContainer(out UnsafeNativeMethods.IOleContainer container)
{
container = this.Host.Container;
return NativeMethods.S_OK;
}
示例12: SetBool
void SetBool(UnsafeNativeMethods.FileWriteOptionsBoolConsts which, bool value)
{
if (m_bDoDelete) // means this is not "const"
UnsafeNativeMethods.CRhinoFileWriteOptions_SetBool(m_ptr, which, value);
}
示例13: ResizeBorder
public int ResizeBorder(
NativeMethods.COMRECT rect,
UnsafeNativeMethods.IOleInPlaceUIWindow doc,
bool fFrameWindow)
{
// We don't have any UI by default, so pretend we updated it.
return NativeMethods.SRESULTS.S_OK;
}
示例14: GetHGlobalFromILockBytes
public static extern IntPtr GetHGlobalFromILockBytes(UnsafeNativeMethods.ILockBytes pLkbyt);
示例15: StgCreateDocfileOnILockBytes
public static extern UnsafeNativeMethods.IStorage StgCreateDocfileOnILockBytes(UnsafeNativeMethods.ILockBytes iLockBytes, int grfMode, int reserved);