SetWindowLong() static private method

static private SetWindowLong ( IntPtr handle, GetWindowLongOffsets item, IntPtr newValue ) : IntPtr
handle IntPtr
item GetWindowLongOffsets
newValue IntPtr
return IntPtr
Beispiel #1
0
        void ProcessEvents()
        {
            Native = ConstructMessageWindow();
            CreateDrivers();

            // Subclass the window to retrieve the events we are interested in.
            OldWndProc = Functions.SetWindowLong(Parent.Handle, WndProc);
            Debug.Print("Input window attached to {0}", Parent);

            InputReady.Set();

            MSG msg = new MSG();

            while (Native.Exists)
            {
                int ret = Functions.GetMessage(ref msg, Parent.Handle, 0, 0);
                if (ret == -1)
                {
                    throw new PlatformException(String.Format(
                                                    "An error happened while processing the message queue. Windows error: {0}",
                                                    Marshal.GetLastWin32Error()));
                }

                Functions.TranslateMessage(ref msg);
                Functions.DispatchMessage(ref msg);
            }
        }
Beispiel #2
0
        public WinInputBase()
        {
            WndProc = WndProcHandler;

            Parent = new WinWindowInfo(NativeWindow.OsuWindowHandle, null);
            CreateDrivers();

            // Subclass the window to retrieve the events we are interested in.
            OldWndProc = Functions.SetWindowLong(Parent.Handle, WndProc);
            Debug.Print("Input window attached to {0}", Parent);
        }
Beispiel #3
0
        private void ProcessEvents()
        {
            this.Native = this.ConstructMessageWindow();
            this.CreateDrivers();
            this.OldWndProc = Functions.SetWindowLong(this.Parent.WindowHandle, this.WndProc);
            this.InputReady.Set();
            MSG msg = new MSG();

            while (this.Native.Exists)
            {
                if (Functions.GetMessage(ref msg, this.Parent.WindowHandle, 0, 0) == -1)
                {
                    throw new PlatformException(string.Format("An error happened while processing the message queue. Windows error: {0}", (object)Marshal.GetLastWin32Error()));
                }
                Functions.TranslateMessage(ref msg);
                Functions.DispatchMessage(ref msg);
            }
        }
Beispiel #4
0
 internal static IntPtr SetWindowLong(IntPtr handle, WindowProcedure newValue)
 {
     return(Functions.SetWindowLong(handle, GetWindowLongOffsets.WNDPROC, Marshal.GetFunctionPointerForDelegate((Delegate)newValue)));
 }
Beispiel #5
0
        internal static IntPtr SetWindowLong(IntPtr handle, GetWindowLongOffsets item, IntPtr newValue)
        {
            IntPtr num = IntPtr.Zero;

            Functions.SetLastError(0);
            num = IntPtr.Size != 4 ? Functions.SetWindowLongPtr(handle, item, newValue) : new IntPtr(Functions.SetWindowLong(handle, item, newValue.ToInt32()));
            if (num == IntPtr.Zero)
            {
                int lastWin32Error = Marshal.GetLastWin32Error();
                if (lastWin32Error != 0)
                {
                    throw new PlatformException(string.Format("Failed to modify window border. Error: {0}", (object)lastWin32Error));
                }
            }
            return(num);
        }