コード例 #1
0
        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));
        }
コード例 #2
0
		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));
			}
		}
コード例 #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)));
 }
コード例 #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)));
 }
コード例 #5
0
ファイル: WindowMethods.cs プロジェクト: nkaluva/EyeAuras
        public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong i)
        {
            if (IntPtr.Size == 8)
            {
                return(GetWindowLongPtr64(hWnd, i));
            }

            return(new IntPtr(GetWindowLong32(hWnd, i)));
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: sishanM/Bili-dl
        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();
        }
コード例 #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)));
     }
 }
コード例 #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())));
     }
 }
コード例 #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;
        }
コード例 #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();
        }
コード例 #11
0
        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;
            }
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #15
0
 internal static extern IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex);
コード例 #16
0
 public static extern uint SetWindowLong(IntPtr hWnd, WindowLong nIndex, uint dwNewLong);
コード例 #17
0
ファイル: XplatUIWin32.cs プロジェクト: ItsVeryWindy/mono
		private extern static uint Win32SetWindowLong(IntPtr hwnd, WindowLong index, uint value);
コード例 #18
0
 static extern int SetWindowLong32(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
コード例 #19
0
 public static extern uint GetWindowLong(IntPtr hWnd, WindowLong nIndex);
コード例 #20
0
ファイル: NativeMethods.cs プロジェクト: RadicalFx/Radical
 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 );
     }
 }
コード例 #21
0
ファイル: HTCNavSensor.cs プロジェクト: windygu/haina
 private static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong windowLong, IntPtr newLong);
コード例 #22
0
ファイル: User32.cs プロジェクト: tangwen831183/CommonWin32
 public static extern uint GetWindowLong(IntPtr hWnd, WindowLong nIndex);
コード例 #23
0
ファイル: User32.cs プロジェクト: tangwen831183/CommonWin32
 public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLong nIndex);
コード例 #24
0
 [DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
コード例 #25
0
ファイル: User32.cs プロジェクト: tangwen831183/CommonWin32
 /// <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));
 }
コード例 #26
0
 [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hWnd, WindowLong nIndex);
コード例 #27
0
ファイル: HTCNavSensor.cs プロジェクト: north0808/haina
 private static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong windowLong, IntPtr newLong);
コード例 #28
0
ファイル: WindowMethods.cs プロジェクト: Hiale/ontopreplica
 static extern int SetWindowLong32(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
コード例 #29
0
ファイル: WindowMethods.cs プロジェクト: Hiale/ontopreplica
 static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
コード例 #30
0
 public static extern int GetWindowLongW(
     WindowHandle hWnd,
     WindowLong nIndex);
コード例 #31
0
ファイル: NativeMethods.cs プロジェクト: RadicalFx/Radical
 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 );
     }
 }
コード例 #32
0
 public static extern int SetWindowLongW(
     WindowHandle hWnd,
     WindowLong nIndex,
     int dwNewLong);
コード例 #33
0
 internal static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong); // only x86 supported
コード例 #34
0
ファイル: WindowMethods.cs プロジェクト: Hiale/ontopreplica
 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()));
     }
 }
コード例 #35
0
 public static int GetWindowLong(IntPtr hwnd, WindowLong longType)
 {
     return GetWindowLong(hwnd, (int)longType);
 }
コード例 #36
0
 public static IntPtr SetWindowLong(this WindowHandle window, WindowLong index, IntPtr value)
 => WindowMethods.SetWindowLong(window, index, value);
コード例 #37
0
 internal static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
コード例 #38
0
 public static IntPtr GetWindowLong(this WindowHandle window, WindowLong index) => WindowMethods.GetWindowLong(window, index);
コード例 #39
0
 public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLong nIndex);
コード例 #40
0
ファイル: WindowMethods.cs プロジェクト: nkaluva/EyeAuras
 private static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
コード例 #41
0
 public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
コード例 #42
0
ファイル: WindowMethods.cs プロジェクト: nkaluva/EyeAuras
 private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
コード例 #43
0
ファイル: XplatUIWin32.cs プロジェクト: ItsVeryWindy/mono
		private extern static uint Win32GetWindowLong(IntPtr hwnd, WindowLong index);
コード例 #44
0
 internal static extern IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex);
コード例 #45
0
ファイル: User32.cs プロジェクト: tangwen831183/CommonWin32
 public static extern uint SetWindowLong(IntPtr hWnd, WindowLong nIndex, uint dwNewLong);
コード例 #46
0
ファイル: WindowMethods.cs プロジェクト: Hiale/ontopreplica
 static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
コード例 #47
0
 public static extern long GetWindowLongPtrW(
     WindowHandle hWnd,
     WindowLong nIndex);
コード例 #48
0
ファイル: User32.cs プロジェクト: tangwen831183/CommonWin32
 public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
コード例 #49
0
 public static extern long SetWindowLongPtrW(
     WindowHandle hWnd,
     WindowLong nIndex,
     long dwNewLong);
コード例 #50
0
ファイル: User32.cs プロジェクト: tangwen831183/CommonWin32
 /// <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));
 }