mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
Co-authored-by: Alexis Campailla <alexis@janeasystems.com> Co-authored-by: Bret Anderson <bretan@microsoft.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com> Co-authored-by: March Rogers <marchr@microsoft.com> Co-authored-by: Mike Harsh <mharsh@microsoft.com> Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com> Co-authored-by: Oliver Jones <ojones@microsoft.com> Co-authored-by: Patrick Little <plittle@microsoft.com>
37 lines
1.0 KiB
C++
37 lines
1.0 KiB
C++
#pragma once
|
|
#include <optional>
|
|
#include <Windows.h>
|
|
|
|
// Returns RECT with positions of the minmize/maximize buttons of the given window.
|
|
// Does not always work, since some apps draw custom toolbars.
|
|
std::optional<RECT> get_button_pos(HWND hwnd);
|
|
// Gets position of given window.
|
|
std::optional<RECT> get_window_pos(HWND hwnd);
|
|
// Gets mouse postion.
|
|
std::optional<POINT> get_mouse_pos();
|
|
// Calculate sizes
|
|
int width(const RECT& rect);
|
|
int height(const RECT& rect);
|
|
// Compare rects
|
|
bool operator<(const RECT& lhs, const RECT& rhs);
|
|
// Moves and/or resizes small_rect to fit inside big_rect.
|
|
RECT keep_rect_inside_rect(const RECT& small_rect, const RECT& big_rect);
|
|
// Initializes and runs windows message loop
|
|
int run_message_loop();
|
|
|
|
void show_last_error_message(LPCWSTR lpszFunction, DWORD dw);
|
|
|
|
enum WindowState {
|
|
UNKNONW,
|
|
MINIMIZED,
|
|
MAXIMIZED,
|
|
SNAPED_TOP_LEFT,
|
|
SNAPED_LEFT,
|
|
SNAPED_BOTTOM_LEFT,
|
|
SNAPED_TOP_RIGHT,
|
|
SNAPED_RIGHT,
|
|
SNAPED_BOTTOM_RIGHT,
|
|
RESTORED
|
|
};
|
|
WindowState get_window_state(HWND hwnd);
|