private void DisplayWindow_Loaded(object sender, RoutedEventArgs e)
        {
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));
            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) | WindowLong.WS_EX_TOOLWINDOW));
        }
		public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong i) {
			if (IntPtr.Size == 8) {
				return GetWindowLongPtr64(hWnd, (int)i);
			}
			else {
				return new IntPtr(GetWindowLong32(hWnd, (int)i));
			}
		}
Exemplo n.º 3
0
 /// <summary>
 /// Retrieves information about the specified window.
 /// </summary>
 /// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
 /// <param name="nIndex">Index of the value.</param>
 /// <returns></returns>
 public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex)
 {
     if (PlatformInfo.Is64BitProcess)
     {
         return(NativeMethods.GetWindowLongPtr(hWnd, nIndex));
     }
     return(new IntPtr(NativeMethods.GetWindowLong(hWnd, nIndex)));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.
 /// </summary>
 /// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
 /// <param name="nIndex">The zero-based offset to the value to be set.</param>
 /// <param name="dwNewLong">The replacement value.</param>
 /// <returns>If the function succeeds, the return value is the previous value of the specified offset.
 /// If the function fails, the return value is zero. </returns>
 public static IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong)
 {
     if (PlatformInfo.Is64BitProcess)
     {
         return(NativeMethods.SetWindowLongPtr(hWnd, nIndex, dwNewLong));
     }
     return(new IntPtr(NativeMethods.SetWindowLong(hWnd, nIndex, (uint)dwNewLong)));
 }
Exemplo n.º 5
0
        public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong i)
        {
            if (IntPtr.Size == 8)
            {
                return(GetWindowLongPtr64(hWnd, i));
            }

            return(new IntPtr(GetWindowLong32(hWnd, i)));
        }
Exemplo n.º 6
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Enable the minimize animation
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));

            LoadConfig();
        }
Exemplo n.º 7
0
 public static IntPtr GetWindowLong(this IntPtr hWnd, WindowLong i)
 {
     if (IntPtr.Size == 8)
     {
         return(GetWindowLongPtr64(hWnd, (int)i));
     }
     else
     {
         return(new IntPtr(GetWindowLong32(hWnd, (int)i)));
     }
 }
Exemplo n.º 8
0
 public static IntPtr SetWindowLong(IntPtr hWnd, WindowLong i, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
     {
         return(SetWindowLongPtr64(hWnd, i, dwNewLong));
     }
     else
     {
         return(new IntPtr(SetWindowLong32(hWnd, i, dwNewLong.ToInt32())));
     }
 }
Exemplo n.º 9
0
        internal static IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex)
        {
            IntPtr p = NativeMethods.Internal.GetWindowLong(hWnd, nIndex);

            if (p == IntPtr.Zero)
            {
                int errorCoder = Marshal.GetLastWin32Error();

                if (errorCoder != 0)
                    throw new Win32Exception(errorCoder);
            }

            return p;
        }
Exemplo n.º 10
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Enable the minimize animation
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));

            NotificationManager.Activated += ToastHandler.HandleToast;
            NotificationManager.Install();

            LoadConfig();

            UpdateUtil.NewVersionFound += UpdateUtil_NewVersionFound;
            UpdateUtil.StartCheckVersion();
        }
        public void Lock(bool value)
        {
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            if (value && !IsLocked)
            {
                WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) | WindowLong.WS_EX_TRANSPARENT));
                IsLocked = true;
            }
            else if (!value && IsLocked)
            {
                WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) & ~WindowLong.WS_EX_TRANSPARENT));
                IsLocked = false;
            }
        }
Exemplo n.º 12
0
        internal static IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex)
        {
            IntPtr p = NativeMethods.Internal.GetWindowLong(hWnd, nIndex);

            if (p == IntPtr.Zero)
            {
                int errorCoder = Marshal.GetLastWin32Error();

                if (errorCoder != 0)
                {
                    throw new Win32Exception(errorCoder);
                }
            }

            return(p);
        }
Exemplo n.º 13
0
        public static IntPtr SetWindowLong(WindowHandle window, WindowLong index, IntPtr value)
        {
            // Unfortunate, but this is necessary to tell if there is really an error
            ErrorMethods.SetLastError(WindowsError.NO_ERROR);

            IntPtr result = Support.Environment.Is64BitProcess
                ? (IntPtr)Imports.SetWindowLongPtrW(window, index, value.ToInt64())
                : (IntPtr)Imports.SetWindowLongW(window, index, value.ToInt32());

            if (result == IntPtr.Zero)
            {
                Errors.ThrowIfLastErrorNot(WindowsError.ERROR_SUCCESS);
            }

            return(result);
        }
Exemplo n.º 14
0
        // About startup

        private void Main_Loaded(object sender, RoutedEventArgs e)
        {
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));
            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) | WindowLong.WS_EX_TOOLWINDOW));


            DanmakuBox.Items.Clear();
            GiftBox.Items.Clear();
            ConnectBtn.Content   = Application.Current.Resources["Loading"].ToString();
            ConnectBtn.IsEnabled = false;
            RoomIdBox.IsEnabled  = false;

            ((Storyboard)Resources["ShowWindow"]).Completed += delegate
            {
                new Thread(delegate()
                {
                    ConfigManager.LoadStatus();
                    ApplyStatue(ConfigManager.CurrentStatus);

                    Dispatcher.Invoke(new Action(() =>
                    {
                        RoomIdBox.Focus();
                        RoomIdBox.Select(RoomIdBox.Text.Length, 0);
                    }));

                    proformanceMonitor = new PerformanceMonitor();
                    proformanceMonitor.CpuProformanceRecieved += ProformanceMonitor_CpuProformanceRecieved;
                    proformanceMonitor.GpuProformanceRecieved += ProformanceMonitor_GpuProformanceRecieved;
                    bool[] availability = proformanceMonitor.StartMonitoring();
                    Dispatcher.Invoke(new Action(() =>
                    {
                        if (!availability[0])
                        {
                            CpuUsage.Visibility = Visibility.Hidden;
                        }
                        if (!availability[1])
                        {
                            GpuUsage.Visibility = Visibility.Hidden;
                        }
                    }));
                }).Start();
            };
            ((Storyboard)Resources["ShowWindow"]).Begin();
        }
Exemplo n.º 15
0
 internal static extern IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 16
0
 public static extern uint SetWindowLong(IntPtr hWnd, WindowLong nIndex, uint dwNewLong);
Exemplo n.º 17
0
		private extern static uint Win32SetWindowLong(IntPtr hwnd, WindowLong index, uint value);
Exemplo n.º 18
0
 static extern int SetWindowLong32(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
Exemplo n.º 19
0
 public static extern uint GetWindowLong(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 20
0
 public static IntPtr SetWindowLong(
         IntPtr hWnd,
         WindowLong index,
         IntPtr value )
 {
     // Vista WoW64 does not implement SetWindowLong 
     if( IntPtr.Size == 4 )
     {
         return ( IntPtr )Window_SetLong32( hWnd, index, value.ToInt32() );
     }
     else
     {
         return Window_SetLong64( hWnd, index, value );
     }
 }
Exemplo n.º 21
0
 private static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong windowLong, IntPtr newLong);
Exemplo n.º 22
0
 public static extern uint GetWindowLong(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 23
0
 public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 24
0
 [DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
Exemplo n.º 25
0
 /// <summary>
 /// Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.
 /// </summary>
 /// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
 /// <param name="nIndex">The zero-based offset to the value to be set.</param>
 /// <param name="dwNewLong">The replacement value.</param>
 /// <returns>If the function succeeds, the return value is the previous value of the specified offset.
 /// If the function fails, the return value is zero. </returns>
 public static IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong)
 {
     if (PlatformInfo.Is64BitProcess)
     {
         return NativeMethods.SetWindowLongPtr(hWnd, nIndex, dwNewLong);
     }
     return new IntPtr(NativeMethods.SetWindowLong(hWnd, nIndex, (uint)dwNewLong));
 }
Exemplo n.º 26
0
 [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 27
0
 private static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong windowLong, IntPtr newLong);
Exemplo n.º 28
0
 static extern int SetWindowLong32(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
Exemplo n.º 29
0
 static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 30
0
 public static extern int GetWindowLongW(
     WindowHandle hWnd,
     WindowLong nIndex);
Exemplo n.º 31
0
 public static IntPtr GetWindowLong(
         IntPtr hWnd,
         WindowLong index )
 {
     // Vista WoW64 does not implement GetWindowLong 
     if( IntPtr.Size == 4 )
     {
         return ( IntPtr )Window_GetLong32( hWnd, index );
     }
     else
     {
         return Window_GetLong64( hWnd, index );
     }
 }
Exemplo n.º 32
0
 public static extern int SetWindowLongW(
     WindowHandle hWnd,
     WindowLong nIndex,
     int dwNewLong);
Exemplo n.º 33
0
 internal static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong); // only x86 supported
Exemplo n.º 34
0
 public static IntPtr SetWindowLong(IntPtr hWnd, WindowLong i, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8) {
         return SetWindowLongPtr64(hWnd, i, dwNewLong);
     }
     else {
         return new IntPtr(SetWindowLong32(hWnd, i, dwNewLong.ToInt32()));
     }
 }
Exemplo n.º 35
0
 public static int GetWindowLong(IntPtr hwnd, WindowLong longType)
 {
     return GetWindowLong(hwnd, (int)longType);
 }
Exemplo n.º 36
0
 public static IntPtr SetWindowLong(this WindowHandle window, WindowLong index, IntPtr value)
 => WindowMethods.SetWindowLong(window, index, value);
Exemplo n.º 37
0
 internal static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
Exemplo n.º 38
0
 public static IntPtr GetWindowLong(this WindowHandle window, WindowLong index) => WindowMethods.GetWindowLong(window, index);
Exemplo n.º 39
0
 public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 40
0
 private static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 41
0
 public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
Exemplo n.º 42
0
 private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 43
0
		private extern static uint Win32GetWindowLong(IntPtr hwnd, WindowLong index);
Exemplo n.º 44
0
 internal static extern IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 45
0
 public static extern uint SetWindowLong(IntPtr hWnd, WindowLong nIndex, uint dwNewLong);
Exemplo n.º 46
0
 static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
Exemplo n.º 47
0
 public static extern long GetWindowLongPtrW(
     WindowHandle hWnd,
     WindowLong nIndex);
Exemplo n.º 48
0
 public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
Exemplo n.º 49
0
 public static extern long SetWindowLongPtrW(
     WindowHandle hWnd,
     WindowLong nIndex,
     long dwNewLong);
Exemplo n.º 50
0
 /// <summary>
 /// Retrieves information about the specified window. 
 /// </summary>
 /// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
 /// <param name="nIndex">Index of the value.</param>
 /// <returns></returns>
 public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex)
 {
     if (PlatformInfo.Is64BitProcess)
     {
         return NativeMethods.GetWindowLongPtr(hWnd, nIndex);
     }
     return new IntPtr(NativeMethods.GetWindowLong(hWnd, nIndex));
 }