当前位置: 首页>>代码示例>>C#>>正文


C# InteropServices.HandleRef类代码示例

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


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


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