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)); } }
/// <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))); }
/// <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))); }
public static IntPtr GetWindowLong(IntPtr hWnd, WindowLong i) { if (IntPtr.Size == 8) { return(GetWindowLongPtr64(hWnd, i)); } return(new IntPtr(GetWindowLong32(hWnd, i))); }
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(); }
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))); } }
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()))); } }
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; }
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; } }
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); }
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); }
// 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(); }
internal static extern IntPtr GetWindowLong(IntPtr hWnd, WindowLong nIndex);
public static extern uint SetWindowLong(IntPtr hWnd, WindowLong nIndex, uint dwNewLong);
private extern static uint Win32SetWindowLong(IntPtr hwnd, WindowLong index, uint value);
static extern int SetWindowLong32(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
public static extern uint GetWindowLong(IntPtr hWnd, WindowLong nIndex);
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 ); } }
private static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong windowLong, IntPtr newLong);
public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLong nIndex);
[DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr hWnd, WindowLong nIndex, int dwNewLong);
/// <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)); }
[DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hWnd, WindowLong nIndex);
static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
public static extern int GetWindowLongW( WindowHandle hWnd, WindowLong nIndex);
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 ); } }
public static extern int SetWindowLongW( WindowHandle hWnd, WindowLong nIndex, int dwNewLong);
internal static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong); // only x86 supported
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())); } }
public static int GetWindowLong(IntPtr hwnd, WindowLong longType) { return GetWindowLong(hwnd, (int)longType); }
public static IntPtr SetWindowLong(this WindowHandle window, WindowLong index, IntPtr value) => WindowMethods.SetWindowLong(window, index, value);
internal static extern IntPtr SetWindowLong(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
public static IntPtr GetWindowLong(this WindowHandle window, WindowLong index) => WindowMethods.GetWindowLong(window, index);
private static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
public static extern IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLong nIndex, IntPtr dwNewLong);
private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, WindowLong nIndex);
private extern static uint Win32GetWindowLong(IntPtr hwnd, WindowLong index);
static extern int GetWindowLong32(IntPtr hWnd, WindowLong nIndex);
public static extern long GetWindowLongPtrW( WindowHandle hWnd, WindowLong nIndex);
public static extern long SetWindowLongPtrW( WindowHandle hWnd, WindowLong nIndex, long dwNewLong);
/// <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)); }