public static IntPtr FindWindow(string lpClassName, string lpWindowName) { return(User32Methods.FindWindow(lpClassName, lpWindowName)); }
public bool ReleaseDc(IntPtr hdc) { return(User32Methods.ReleaseDC(this.Handle, hdc)); }
public bool Validate(ref Rectangle rect) { return(User32Methods.ValidateRect(this.Handle, ref rect)); }
public bool Hide() { return(User32Methods.ShowWindow(this.Handle, ShowWindowCommands.SW_HIDE)); }
public void EndPaint(ref PaintStruct ps) { User32Methods.EndPaint(this.Handle, ref ps); }
public bool IsEnabled() { return(User32Methods.IsWindowEnabled(this.Handle)); }
public IntPtr GetParam(WindowLongFlags index) { return(User32Methods.GetWindowLongPtr(this.Handle, (int)index)); }
public bool SetText(string text) { return(User32Methods.SetWindowText(this.Handle, text)); }
public bool SetPosition(int x, int y) { return(User32Methods.SetWindowPos(this.Handle, IntPtr.Zero, x, y, -1, -1, WindowPositionFlags.SWP_NOACTIVATE | WindowPositionFlags.SWP_NOSIZE | WindowPositionFlags.SWP_NOZORDER)); }
public bool Invalidate(bool shouldErase = false) { return(User32Methods.InvalidateRect(this.Handle, IntPtr.Zero, shouldErase)); }
public void SetFocus() { User32Methods.SetFocus(this.Handle); }
public bool Invalidate(ref Rectangle rect, bool shouldErase = false) { return(User32Methods.InvalidateRect(this.Handle, ref rect, shouldErase)); }
public static Rectangle GetWindowRect(IntPtr Hwnd) { var result = User32Methods.GetWindowRect(Hwnd, out Rectangle win_rectangle); return(win_rectangle); }
public static void SetForegroundWindow(IntPtr Hwnd) { User32Methods.SetForegroundWindow(Hwnd); }
public bool GetClientRect(out Rectangle rectangle) { return(User32Methods.GetClientRect(this.Handle, out rectangle)); }
public bool SetPosition(int x, int y, int width, int height) { return(User32Methods.SetWindowPos(this.Handle, IntPtr.Zero, x, y, width, height, WindowPositionFlags.SWP_NOACTIVATE | WindowPositionFlags.SWP_NOZORDER)); }
public bool IsVisible() { return(User32Methods.IsWindowVisible(this.Handle)); }
public bool SetPosition(int x, int y, int width, int height, WindowPositionFlags flags) { return(User32Methods.SetWindowPos(this.Handle, IntPtr.Zero, x, y, width, height, flags)); }
public IntPtr SetParam(WindowLongFlags index, IntPtr value) { return(User32Methods.SetWindowLongPtr(this.Handle, (int)index, value)); }
public bool SetPosition(IntPtr hWndInsertAfter, int x, int y, int width, int height, WindowPositionFlags flags) { return(User32Methods.SetWindowPos(this.Handle, hWndInsertAfter, x, y, width, height, flags)); }
public bool Show() { return(User32Methods.ShowWindow(this.Handle, ShowWindowCommands.SW_SHOW)); }
private static IntPtr WindowProc(IntPtr hwnd, uint umsg, IntPtr wParam, IntPtr lParam) { IntPtr result = IntPtr.Zero; var msg = (WM)umsg; switch (msg) { case WM.ERASEBKGND: return(new IntPtr(1)); case WM.CLOSE: User32Methods.PostQuitMessage(0); break; case WM.PAINT: { var hdc = User32Methods.BeginPaint(hwnd, out PaintStruct ps); User32Methods.FillRect(hdc, ref ps.PaintRect, Gdi32Helpers.GetStockObject(StockObject.WHITE_BRUSH)); User32Methods.EndPaint(hwnd, ref ps); break; } case WM.KEYDOWN: InputManager.Instance.KeyPressed((VirtualKey)wParam.ToInt32(), lParam.ToInt32() & 0x40000000); break; case WM.KEYUP: InputManager.Instance.KeyReleased((VirtualKey)wParam.ToInt32()); break; case WM.CHAR: InputManager.Instance.KeyTyped((char)wParam.ToInt32()); break; case WM.MOUSEMOVE: { int x = unchecked ((short)(long)lParam); int y = unchecked ((short)((long)lParam >> 16)); InputManager.Instance.MouseMoved(x, y); break; } case WM.LBUTTONDOWN: { int x = unchecked ((short)(long)lParam); int y = unchecked ((short)((long)lParam >> 16)); InputManager.Instance.MousePressed(MouseButton.Left, x, y); break; } case WM.LBUTTONUP: { int x = unchecked ((short)(long)lParam); int y = unchecked ((short)((long)lParam >> 16)); InputManager.Instance.MouseReleased(MouseButton.Left, x, y); break; } case WM.RBUTTONDOWN: { int x = unchecked ((short)(long)lParam); int y = unchecked ((short)((long)lParam >> 16)); InputManager.Instance.MousePressed(MouseButton.Right, x, y); break; } case WM.RBUTTONUP: { int x = unchecked ((short)(long)lParam); int y = unchecked ((short)((long)lParam >> 16)); InputManager.Instance.MouseReleased(MouseButton.Right, x, y); break; } default: result = User32Methods.DefWindowProc(hwnd, umsg, wParam, lParam); break; } return(result); }
public IntPtr BeginPaint(out PaintStruct ps) { return(User32Methods.BeginPaint(this.Handle, out ps)); }
public void OnTick() { User32Methods.SetWindowText(m_hWnd, $"{m_Info.Title} | {m_Info.FPS} fps, {m_Info.UPS} ups"); }
public IntPtr GetWindowDc() { return(User32Methods.GetWindowDC(this.Handle)); }
/// <summary> /// The exit. /// </summary> public static void Exit() { User32Methods.PostQuitMessage(0); }
public bool SetState(ShowWindowCommands flags) { return(User32Methods.ShowWindow(this.Handle, flags)); }
/// <summary> /// The close window externally. /// </summary> public void CloseWindowExternally() { User32Methods.PostMessage(Handle, (uint)WM.CLOSE, IntPtr.Zero, IntPtr.Zero); }
public bool Validate() { return(User32Methods.ValidateRect(this.Handle, IntPtr.Zero)); }
public static void SetMousePos(int x, int y) { User32Methods.SetPhysicalCursorPos(x, y); }