コード例 #1
0
        private static void UpdateCursors(IntPtr[] cursors)
        {
            int i = 0;

            foreach (var cursor in cursorIds)
            {
                var hc = User32.CopyImage(cursors[i], 2, 0, 0, 0);
                User32.SetSystemCursor(hc, (UInt32)cursor);
            }
        }
コード例 #2
0
        static MouseHider()
        {
            cursorIds       = Enums.Values <User32Types.CursorName>().Cast <uint>().ToArray();
            OriginalCursors = new IntPtr[cursorIds.Length];
            blankCursors    = new IntPtr[cursorIds.Length];
            int i     = 0;
            var blank = User32.CreateCursor(IntPtr.Zero, 0, 0, 32, 32, ((byte)0xFF).Repeat(32 * 4).ToArray(), ((byte)0x00).Repeat(32 * 4).ToArray());

            foreach (var cursor in cursorIds)
            {
                var hc = User32.LoadCursor(IntPtr.Zero, (IntPtr)cursor);
                OriginalCursors[i] = User32.CopyImage(hc, 2, 0, 0, 0);
                blankCursors[i]    = blank;
                i++;
            }

            AppDomain.CurrentDomain.ProcessExit += OnProcessExit;
        }
コード例 #3
0
            public static PICTDESC FromIcon(Icon icon, bool copy)
            {
                PICTDESC desc = new PICTDESC
                {
                    picType = PICTYPE.ICON
                };

                desc.Union.icon.hicon = copy ?
                                        User32.CopyImage(
                    icon.Handle,
                    User32.IMAGE.ICON,
                    icon.Width,
                    icon.Height,
                    User32.LR.DEFAULTCOLOR)
                    : icon.Handle;

                GC.KeepAlive(icon);
                return(desc);
            }