Table of Contents

Interface INativeManager

Namespace
Whim
Assembly
Whim.dll
Manager for interacting with native Windows APIs.
public interface INativeManager

Properties

Compositor

The compositor for Whim.
Compositor Compositor { get; }

Property Value

Compositor

Methods

CreateTransparentWindowController(Window)

Creates a TransparentWindowController for the given window.
TransparentWindowController CreateTransparentWindowController(Window window)

Parameters

window Window

Returns

TransparentWindowController

DeferWindowPos()

Creates a handle which will facilitates setting the position of multiple windows at once.
DeferWindowPosHandle DeferWindowPos()

Returns

DeferWindowPosHandle

DeferWindowPos(IEnumerable<DeferWindowPosState>)

Creates a handle which will facilitates setting the position of multiple windows at once.
DeferWindowPosHandle DeferWindowPos(IEnumerable<DeferWindowPosState> windowStates)

Parameters

windowStates IEnumerable<DeferWindowPosState>
The initial window states to set.

Returns

DeferWindowPosHandle

DwmGetWindowRectangle(HWND)

Returns the window's rectangle from DWM.
IRectangle<int>? DwmGetWindowRectangle(HWND hwnd)

Parameters

hwnd HWND

Returns

IRectangle<int>

ForceForegroundWindow(HWND)

Force the window to the foreground.
void ForceForegroundWindow(HWND hwnd)

Parameters

hwnd HWND

GetClassName(HWND)

Safe wrapper around GetClassName(HWND, PWSTR, int).
string GetClassName(HWND hwnd)

Parameters

hwnd HWND

Returns

string

GetUwpAppProcessPath(IWindow)

Retrieves the path to the executable file of the UWP app associated with the given window. This will only work for UWP apps (see IsUwp).
string? GetUwpAppProcessPath(IWindow window)

Parameters

window IWindow

Returns

string

GetWhimVersion()

Gets the version of Whim.
string GetWhimVersion()

Returns

string

GetWindowOffset(HWND)

Returns the window's offset.
This is based on the issue raised at https://github.com/workspacer/workspacer/issues/139, and the associated fix from https://github.com/workspacer/workspacer/pull/146.
IRectangle<int>? GetWindowOffset(HWND hwnd)

Parameters

hwnd HWND

Returns

IRectangle<int>

HideCaptionButtons(HWND)

Hides the caption buttons from the given window.
void HideCaptionButtons(HWND hwnd)

Parameters

hwnd HWND

HideWindow(HWND)

Hides the window of the associated handle.
bool HideWindow(HWND hwnd)

Parameters

hwnd HWND

Returns

bool

MinimizeWindow(HWND)

Minimizes the specified window and activates the next top-level window in the Z order.
bool MinimizeWindow(HWND hwnd)

Parameters

hwnd HWND

Returns

bool

PreventWindowActivation(HWND)

Prevent the window from being activated.
void PreventWindowActivation(HWND hwnd)

Parameters

hwnd HWND

QuitWindow(HWND)

Quit the window.
void QuitWindow(HWND hwnd)

Parameters

hwnd HWND

RemoveWindowExTransparent(HWND)

Removes the transparency from the given hwnd.
void RemoveWindowExTransparent(HWND hwnd)

Parameters

hwnd HWND

RestoreWindow(HWND)

Activates and displays the window. If the window is minimized, maximized, or arranged, the system restores it to its original size and position
bool RestoreWindow(HWND hwnd)

Parameters

hwnd HWND

Returns

bool

SetWindowCorners(HWND, DWM_WINDOW_CORNER_PREFERENCE)

Sets the preferred window corners for the given hwnd. By default, the window corners are rounded.
void SetWindowCorners(HWND hwnd, DWM_WINDOW_CORNER_PREFERENCE preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND)

Parameters

hwnd HWND
preference DWM_WINDOW_CORNER_PREFERENCE

SetWindowExTransparent(HWND)

Sets the given hwnd to be transparent to mouse clicks.
void SetWindowExTransparent(HWND hwnd)

Parameters

hwnd HWND

ShouldSystemUseDarkMode()

Gets whether the system is using dark mode.
bool ShouldSystemUseDarkMode()

Returns

bool

ShowWindowMaximized(HWND)

Activates the window and displays it as a maximized window.
bool ShowWindowMaximized(HWND hwnd)

Parameters

hwnd HWND

Returns

bool

ShowWindowMinimized(HWND)

Activates the window and displays it as a minimized window.
bool ShowWindowMinimized(HWND hwnd)

Parameters

hwnd HWND

Returns

bool

ShowWindowNoActivate(HWND)

Displays a window in its most recent size and position. The window is not activated.
bool ShowWindowNoActivate(HWND hwnd)

Parameters

hwnd HWND

Returns

bool

TryEnqueue(DispatcherQueueHandler)

Adds a task to the DispatcherQueue which will be executed on the thread associated with the DispatcherQueue.
bool TryEnqueue(DispatcherQueueHandler callback)

Parameters

callback DispatcherQueueHandler
The task to execute.

Returns

bool
true indicates that the task was added to the queue; false, otherwise.