RadioDld.NativeMethods.SetCursor C# (CSharp) Method

SetCursor() private method

private SetCursor ( IntPtr hCursor ) : IntPtr
hCursor System.IntPtr
return System.IntPtr
        public static extern IntPtr SetCursor(IntPtr hCursor);

Usage Example

Example #1
0
        /// <summary>
        /// Handle the WM_SETCURSOR message and set the correct system link cursor.
        /// </summary>
        /// <param name="m">The Windows <see cref="Message" /> to process.</param>
        protected override void WndProc(ref Message m)
        {
            if (OsUtils.Windows() && m.Msg == NativeMethods.WM_SETCURSOR)
            {
                // Fetch a handle to the system 'hand' cursor.
                IntPtr cursor = NativeMethods.LoadCursor(IntPtr.Zero, (IntPtr)NativeMethods.IDC_HAND);

                // NULL cursor
                if (cursor == IntPtr.Zero)
                {
                    throw new Win32Exception();
                }

                // Set this control's cursor to the 'hand'
                NativeMethods.SetCursor(cursor);

                // Show that the message has been handled successfully
                m.Result = IntPtr.Zero;
                return;
            }

            base.WndProc(ref m);
        }