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

C# InteropServices.HandleRef类代码示例

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

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



HandleRef类属于System.Runtime.InteropServices命名空间,在下文中一共展示了HandleRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetWindowLongPtr

 // This static method is required because legacy OSes do not support
 // SetWindowLongPtr
 internal static IntPtr SetWindowLongPtr(HandleRef hWnd, int nIndex, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
         return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
     else
         return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:Win32Interop.cs


示例2: CompilationMutex

    internal CompilationMutex(String name, String comment) {

#if !FEATURE_PAL // No unmanaged aspnet_isapi mutex in Coriolis

        // Attempt to get the mutex string from the registry (VSWhidbey 415795)
        string mutexRandomName = (string) Misc.GetAspNetRegValue("CompilationMutexName",
            null /*valueName*/, null /*defaultValue*/);

        if (mutexRandomName != null) {
            // If we were able to use the registry value, use it.  Also, we need to prepend "Global\"
            // to the mutex name, to make sure it can be shared between a terminal server session
            // and IIS (VSWhidbey 307523).
            _name += @"Global\" + name + "-" + mutexRandomName;
        }
        else {
            // If we couldn't get the reg value, don't use it, and prepend "Local\" to the mutex
            // name to make it local to the session (and hence prevent hijacking)
            _name += @"Local\" + name;
        }

        _comment = comment;

        Debug.Trace("Mutex", "Creating Mutex " + MutexDebugName);

        _mutexHandle = new HandleRef(this, UnsafeNativeMethods.InstrumentedMutexCreate(_name));

        if (_mutexHandle.Handle == IntPtr.Zero) {
            Debug.Trace("Mutex", "Failed to create Mutex " + MutexDebugName);

            throw new InvalidOperationException(SR.GetString(SR.CompilationMutex_Create));
        }

        Debug.Trace("Mutex", "Successfully created Mutex " + MutexDebugName);
#endif // !FEATURE_PAL
    }
开发者ID:uQr,项目名称:referencesource,代码行数:35,代码来源:CompilationLock.cs


示例3: SetWindowLong

 public static IntPtr SetWindowLong(HandleRef hwnd, Win32Native.WindowLongType index, IntPtr wndProcPtr)
 {
     if (IntPtr.Size == 4)
     return Win32Native.SetWindowLong32(hwnd, index, wndProcPtr);
       else
     return Win32Native.SetWindowLongPtr64(hwnd, index, wndProcPtr);
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:Win32Native.cs


示例4: Profile

        public Profile(string path)
        {
            Handle = new HandleRef (this, NativeMethods.CmsOpenProfileFromFile (path, "r"));

            if (Handle.Handle == IntPtr.Zero)
                throw new CmsException ("Error opening ICC profile in file " + path);
        }
开发者ID:modulexcite,项目名称:f-spot,代码行数:7,代码来源:Profile.cs


示例5: BuildWindowCore

 protected override HandleRef BuildWindowCore(HandleRef hwndParent)
 {
     DestroyHost();
     _host = new WinFormsAvaloniaControlHost {Content = _content};
     UnmanagedMethods.SetParent(_host.Handle, hwndParent.Handle);
     return new HandleRef(this, _host.Handle);
 }
开发者ID:jkoritzinsky,项目名称:Avalonia,代码行数:7,代码来源:WpfAvaloniaControlHost.cs


示例6: Client

        //private static readonly int CDINDEX_ID_LEN = 28;
        //private static readonly int ID_LEN = 36;
        public Client()
        {
            handle = new HandleRef(this, mb_New());
            UseUtf8 = true;

            AutoSetProxy();
        }
开发者ID:jrmuizel,项目名称:banshee-unofficial-plugins,代码行数:9,代码来源:Client.cs


示例7: Unregister

 internal static void Unregister(HandleRef unmanaged)
 {
     lock (Instance)
     {
         Instance.UnregisterImpl(unmanaged.Handle);
     }
 }
开发者ID:WBasti,项目名称:CoherentUIMobileOpenSource,代码行数:7,代码来源:UnmanagedReference.cs


示例8: SnapshotManager_Open

 internal static extern void SnapshotManager_Open(
     HandleRef self,
      /* from(DataSource_t) */ Types.DataSource data_source,
      /* from(char const *) */ string file_name,
      /* from(SnapshotConflictPolicy_t) */ Types.SnapshotConflictPolicy conflict_policy,
      /* from(SnapshotManager_OpenCallback_t) */ OpenCallback callback,
      /* from(void *) */ IntPtr callback_arg);
开发者ID:MichaelLyon,项目名称:Ralphs-Revenge,代码行数:7,代码来源:SnapshotManager.cs


示例9: DrawPie

        /// Drawing methods.

        /// <devdoc>
        /// </devdoc>
        public void DrawPie(WindowsPen pen, Rectangle bounds, float startAngle, float sweepAngle) 
        {
            HandleRef hdc = new HandleRef( this.dc, this.dc.Hdc);

            if( pen != null )
            {
                // 1. Select the pen in the DC
                IntUnsafeNativeMethods.SelectObject(hdc, new HandleRef(pen, pen.HPen));
            }

            // 2. call the functions
            // we first draw a path that goes : 
            // from center of pie, draw arc (this draw the line to the beginning of the arc
            // then, draw the closing line.
            // paint the path with the pen
            int sideLength = Math.Min(bounds.Width, bounds.Height);
            Point p = new Point(bounds.X+sideLength/2, bounds.Y+sideLength/2);
            int radius = sideLength/2;
            IntUnsafeNativeMethods.BeginPath(hdc);
            IntUnsafeNativeMethods.MoveToEx(hdc, p.X, p.Y, null);
            IntUnsafeNativeMethods.AngleArc(hdc, p.X, p.Y, radius, startAngle, sweepAngle);
            IntUnsafeNativeMethods.LineTo(hdc, p.X, p.Y);
            IntUnsafeNativeMethods.EndPath(hdc);
            IntUnsafeNativeMethods.StrokePath(hdc);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:29,代码来源:WindowsGraphics2.cs


示例10: SHGetFolderLocation

		public static extern int SHGetFolderLocation(
			HandleRef hwndOwner,
			int nFolder,
			IntPtr hToken,
			int dwReserved,
			out IntPtr ppidl
			);
开发者ID:skwasjer,项目名称:skwas.Forms,代码行数:7,代码来源:SafeNativeMethods.cs


示例11: RazorBitmapFormAntiparents

        public RazorBitmapFormAntiparents()
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.DoubleBuffer, false);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.Opaque, true);

            SimpleParticlesWorld.Size = this.ClientSize;

            this.task = Task.Factory.StartNew(() =>
                {
                    using (Graphics graphics = this.CreateGraphics())
                    {
                        IntPtr hdc = IntPtr.Zero;
                        try
                        {
                            hdc = graphics.GetHdc();
                            HandleRef handleRef = new HandleRef(graphics, hdc);

                            while (!this.IsTerminate)
                            {
                                this.commonStopwatch.Restart();

                                this.updateStopwatch.Restart();
                                SimpleParticlesWorld.Update();
                                this.updateTime = this.updateStopwatch.ElapsedMilliseconds;

                                this.renderStopwatch.Restart();
                                Array.Clear(this.array, 0, this.array.Length);
                                SimpleParticle particle;
                                int pointBase;
                                for (int i = SimpleParticlesWorld.Particles.Count - 1; i >= 0; --i)
                                {
                                    particle = SimpleParticlesWorld.Particles[i];
                                    //foreach (SimpleParticle particle in SimpleParticlesWorld.Particles)
                                    //{
                                    pointBase = (this.size.Height - (int)particle.y) * this.size.Width + (int)particle.x;
                                    if (0 <= pointBase && pointBase < this.array.Length)
                                    {
                                        this.array[pointBase] = particle.c;
                                    }
                                }
                                SetDIBitsToDevice(handleRef, 0, 0, this.size.Width, this.size.Height, 0, 0, 0, this.size.Height, ref this.array[0], ref this.bitmapInfo, 0);
                                this.renderTime = this.renderStopwatch.ElapsedMilliseconds;

                                this.commonTime = this.commonStopwatch.ElapsedMilliseconds;
                            }
                        }
                        finally
                        {
                            if (hdc != IntPtr.Zero)
                            {
                                graphics.ReleaseHdc(hdc);
                            }
                        }
                    }
                });
        }
开发者ID:Ring-r,项目名称:sandbox,代码行数:60,代码来源:RazorBitmapFormAntiparents.cs


示例12: BuildWindowCore

 /// <summary>
 /// コントロール作成
 /// </summary>
 /// <param name="hwndParent">親ウィンドウ</param>
 /// <returns>
 /// 作成されたコントロールの HandleRef 
 /// </returns>
 protected override HandleRef BuildWindowCore(HandleRef hwndParent)
 {
     Dispatcher.ShutdownStarted += DispatcherOnShutdownStarted;
     return new HandleRef(this,
         _wnd.CreateWindow(hwndParent.Handle)
         );
 }
开发者ID:jugemjugem,项目名称:libShootTheSpeed,代码行数:14,代码来源:VideoContainer.cs


示例13: BuildWindowCore

        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            // Let our base class create the standard window.  We will simply
            // use it as the parent of our HwndSource.
            // HandleRef hwndChild = base.BuildWindowCore(hwndParent);

            HwndSourceParameters? optCreationParameters = CreationParameters;

            if (_thread != null)
            {
                // Asynchronously create the HwndSource on the worker thread.
                _thread.Dispatcher.BeginInvoke((Action)delegate
                {
                    _hwndSource = CreateHwndSource(optCreationParameters, hwndParent.Handle);
                });
            }
            else
            {
                // Synchronously create the HwndSource on the UI thread.
                _hwndSource = CreateHwndSource(optCreationParameters, hwndParent.Handle);
            }

            UpdateRootVisual(Source);

            return new HandleRef(this,_hwndSource.Handle);
        }
开发者ID:JazzFisch,项目名称:AnotherCombatManager,代码行数:26,代码来源:HwndSourceElement.cs


示例14: BuildWindowCore

        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            HwndListBox = IntPtr.Zero;
            _hwndHost = IntPtr.Zero;

            _hwndHost = CreateWindowEx(0, "static", "",
                WsChild | WsVisible,
                0, 0,
                _hostHeight, _hostWidth,
                hwndParent.Handle,
                (IntPtr) HostId,
                IntPtr.Zero,
                0);

            HwndListBox = CreateWindowEx(0, "listbox", "",
                WsChild | WsVisible | LbsNotify
                | WsVscroll | WsBorder,
                0, 0,
                _hostHeight, _hostWidth,
                _hwndHost,
                (IntPtr) ListboxId,
                IntPtr.Zero,
                0);

            return new HandleRef(this, _hwndHost);
        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:26,代码来源:ControlHost.cs


示例15: RealTimeMultiplayerManager_SendUnreliableMessage

 internal static extern void RealTimeMultiplayerManager_SendUnreliableMessage(
     HandleRef self,
  /* from(RealTimeRoom_t) */IntPtr room,
  /* from(MultiplayerParticipant_t const *) */IntPtr[] participants,
  /* from(size_t) */UIntPtr participants_size,
  /* from(uint8_t const *) */byte[] data,
  /* from(size_t) */UIntPtr data_size);
开发者ID:CodingDuff,项目名称:play-games-plugin-for-unity,代码行数:7,代码来源:RealTimeMultiplayerManager.cs


示例16: Font

        public Font( Type font )
        {
            IntPtr fontHandle;

            switch( font )
            {
                case Type.Small:
                    fontHandle = GDImport.gdFontGetSmall();
                    break;
                case Type.Large:
                    fontHandle = GDImport.gdFontGetLarge();
                    break;
                case Type.MediumBold:
                    fontHandle = GDImport.gdFontGetMediumBold();
                    break;
                case Type.Giant:
                    fontHandle = GDImport.gdFontGetGiant();
                    break;
                case Type.Tiny:
                    fontHandle = GDImport.gdFontGetTiny();
                    break;
                default:
                    throw new ApplicationException( font + " is no valid font." );
            }

            if( fontHandle == IntPtr.Zero )
                throw new ApplicationException( "The font retrieval failed." );

            this.handle = new HandleRef( this, fontHandle );
        }
开发者ID:zer0x304,项目名称:gd-sharp,代码行数:30,代码来源:Font.cs


示例17: SendStopMessage

        public static void SendStopMessage(this Process process)
        {
            Debug.Assert(process != null);

            try
            {
                if (!process.HasExited)
                {
                    var processId = process.Id;

                    for (var ptr = NativeMethods.GetTopWindow(IntPtr.Zero);
                        ptr != IntPtr.Zero;
                        ptr = NativeMethods.GetWindow(ptr, 2))
                    {
                        uint num;
                        NativeMethods.GetWindowThreadProcessId(ptr, out num);
                        if (processId == num)
                        {
                            var hWnd = new HandleRef(null, ptr);
                            NativeMethods.PostMessage(hWnd, 0x12, IntPtr.Zero, IntPtr.Zero);
                            return;
                        }
                    }
                }
            }
            catch (InvalidOperationException) { }
            catch (ArgumentException) { }
        }
开发者ID:calebjenkins,项目名称:automation-webhosting,代码行数:28,代码来源:ProcessExtensions.cs


示例18: Register

 internal static void Register(HandleRef unmanaged)
 {
     lock (Instance)
     {
         Instance.RegisterImpl(unmanaged);
     }
 }
开发者ID:WBasti,项目名称:CoherentUIMobileOpenSource,代码行数:7,代码来源:UnmanagedReference.cs


示例19: BuildWindowCore

        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            m_msgMng.m_hwndGLParent = IntPtr.Zero;

            m_msgMng.m_hwndGLParent = CreateWindowEx(
                0, "static", "",
                WS_CHILD | WS_VISIBLE,
                0, 0,
                m_hostWidth, m_hostHeight,
                hwndParent.Handle,
                (IntPtr)HOST_ID,
                IntPtr.Zero,
                0);

            string strRunMode;

            if (MainWindow.s_pW.m_isDebug)
            {
                strRunMode = "true";
            }
            else
            {
                strRunMode = "false";
            }

            m_process = System.Diagnostics.Process.Start(
                MainWindow.s_pW.m_pathGlApp,
                    m_hostWidth.ToString() + " " +
                    m_hostHeight.ToString() + " " +
                    m_msgMng.m_hwndGLParent.ToString() + " " +
                    strRunMode);

            return new HandleRef(this, m_msgMng.m_hwndGLParent);
        }
开发者ID:jaffrykee,项目名称:ui,代码行数:34,代码来源:ControlHost.cs


示例20: LeaderboardManager_FetchScorePage

 internal static extern void LeaderboardManager_FetchScorePage(
     HandleRef self,
      /* from(DataSource_t) */ Types.DataSource data_source,
      /* from(ScorePage_ScorePageToken_t) */ IntPtr token,
      /* from(uint32_t) */ uint max_results,
      /* from(LeaderboardManager_FetchScorePageCallback_t) */ FetchScorePageCallback callback,
      /* from(void *) */ IntPtr callback_arg);
开发者ID:JoshuaHassler,项目名称:PMG,代码行数:7,代码来源:LeaderboardManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# InteropServices.SafeHandle类代码示例发布时间:2022-05-26
下一篇:
C# InteropServices.GCHandle类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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