• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UnsafeNativeMethods类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnsafeNativeMethods的典型用法代码示例。如果您正苦于以下问题:C# UnsafeNativeMethods类的具体用法?C# UnsafeNativeMethods怎么用?C# UnsafeNativeMethods使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnsafeNativeMethods类属于命名空间,在下文中一共展示了UnsafeNativeMethods类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:26,代码来源:ActiveXContainer.cs


示例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;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:HtmlWindow.cs


示例3: GetDropTarget

 public int GetDropTarget(
     UnsafeNativeMethods.IOleDropTarget pDropTarget,
     out UnsafeNativeMethods.IOleDropTarget ppDropTarget)
 {
     // no additional drop target
     ppDropTarget = pDropTarget;
     return NativeMethods.SRESULTS.S_FALSE;
 }
开发者ID:CMONO,项目名称:ZetaHtmlEditControl,代码行数:8,代码来源:CoreHtmlEditControl.Base.cs


示例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;

        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:HtmlDocument.cs


示例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;

        }
开发者ID:JianwenSun,项目名称:cc,代码行数:8,代码来源:HtmlElement.cs


示例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();
   }
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:10,代码来源:rhinosdkgetline.cs


示例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);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:NativeWrapper.cs


示例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;
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:21,代码来源:groundplane.cs


示例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;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:16,代码来源:WebBrowserContainer.cs


示例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;
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:26,代码来源:groundplane.cs


示例11:

 int UnsafeNativeMethods.IOleClientSite.GetContainer(out UnsafeNativeMethods.IOleContainer container) 
 {
     container = this.Host.Container;
     return NativeMethods.S_OK;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:5,代码来源:ActiveXSite.cs


示例12: SetBool

 void SetBool(UnsafeNativeMethods.FileWriteOptionsBoolConsts which, bool value)
 {
   if (m_bDoDelete) // means this is not "const"
     UnsafeNativeMethods.CRhinoFileWriteOptions_SetBool(m_ptr, which, value);
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:5,代码来源:rhinosdkfileoptions.cs


示例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;
 }
开发者ID:jorik041,项目名称:ZetaHtmlEditControl,代码行数:8,代码来源:HtmlEditControl.cs


示例14: GetHGlobalFromILockBytes

 public static extern IntPtr GetHGlobalFromILockBytes(UnsafeNativeMethods.ILockBytes pLkbyt);
开发者ID:JianwenSun,项目名称:cc,代码行数:1,代码来源:UnsafeNativeMethods.cs


示例15: StgCreateDocfileOnILockBytes

 public static extern UnsafeNativeMethods.IStorage StgCreateDocfileOnILockBytes(UnsafeNativeMethods.ILockBytes iLockBytes, int grfMode, int reserved);
开发者ID:JianwenSun,项目名称:cc,代码行数:1,代码来源:UnsafeNativeMethods.cs


示例16: EnumUnknown

 void UnsafeNativeMethods.IEnumUnknown.Clone(out UnsafeNativeMethods.IEnumUnknown ppenum)
 {
     ppenum = new EnumUnknown(this.arr, this.loc);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:4,代码来源:EnumUnknown.cs


示例17: HtmlElementCollection

 internal HtmlElementCollection(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLElementCollection elements) {
     this.htmlElementCollection = elements;
     this.elementsArray = null;
     this.shimManager = shimManager;
     Debug.Assert(this.NativeHtmlElementCollection != null, "The element collection object should implement IHTMLElementCollection");
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:6,代码来源:HtmlElementCollection.cs


示例18: CallISAPI

        internal int CallISAPI(UnsafeNativeMethods.CallISAPIFunc iFunction, byte [] bufIn, byte [] bufOut) {

            if (_wr == null || !(_wr is System.Web.Hosting.ISAPIWorkerRequest))
                throw new HttpException(SR.GetString(SR.Cannot_call_ISAPI_functions));
#if !FEATURE_PAL // FEATURE_PAL does not enable IIS-based hosting features
            return ((System.Web.Hosting.ISAPIWorkerRequest) _wr).CallISAPI(iFunction, bufIn, bufOut);
#else // !FEATURE_PAL
                throw new NotImplementedException ("ROTORTODO");
#endif // !FEATURE_PAL
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:10,代码来源:HttpContext.cs


示例19: RefreshStorage

 internal State RefreshStorage(UnsafeNativeMethods.IPersistStorage iPersistStorage) {
     Debug.Assert(storage != null, "how can we not have a storage object?");
     Debug.Assert(iLockBytes != null, "how can we have a storage w/o ILockBytes?");
     if (storage == null || iLockBytes == null) return null;
     iPersistStorage.Save(storage, true);
     storage.Commit(0);
     iPersistStorage.HandsOffStorage();
     try {
         buffer = null;
         ms = null;
         NativeMethods.STATSTG stat = new NativeMethods.STATSTG();
         iLockBytes.Stat(stat, NativeMethods.Ole.STATFLAG_NONAME);
         length = (int) stat.cbSize;
         buffer = new byte[length];
         IntPtr hglobal = UnsafeNativeMethods.GetHGlobalFromILockBytes(iLockBytes);
         IntPtr pointer = UnsafeNativeMethods.GlobalLock(new HandleRef(null, hglobal));
         try {
             if (pointer != IntPtr.Zero) {
                 Marshal.Copy(pointer, buffer, 0, length);
             }
             else {
                 length = 0;
                 buffer = null;
             }
         }
         finally {
             UnsafeNativeMethods.GlobalUnlock(new HandleRef(null, hglobal));
         }
     }
     finally {
         iPersistStorage.SaveCompleted(storage);
     }
     return this;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:34,代码来源:AxHost.cs


示例20: TranslateReturnCode

 private static string TranslateReturnCode(UnsafeNativeMethods.CredUIReturnCodes result)
 {
     return string.Format(CultureInfo.CurrentUICulture, Properties.Resources.CredUIReturn, result.ToString());
 }
开发者ID:riseandcode,项目名称:open-wscf-2010,代码行数:4,代码来源:CredentialsDialog.cs



注:本文中的UnsafeNativeMethods类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnsafeStatement类代码示例发布时间:2022-05-24
下一篇:
C# UnsafeBuffer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap