Kanzi 3.9.10
kanzi::win32 Namespace Reference

Classes

struct  DefaultFiberContext
 Structure that represents the default Win32 fiber context. More...
 
class  DefaultWin32WGLGraphicsOutput
 Class that represents the default Win32 WGL graphics output. More...
 
struct  DefaultWin32WGLGraphicsOutputProperties
 Structure that represents the default Win32 WGL graphics output properties. More...
 
class  WGLContext
 Class that represents the WGL context. More...
 
class  Win32DeviceContext
 Class that represents the Win32 device context. More...
 
class  Win32Display
 Class that represents a Win32 display. More...
 
class  Win32DynamicLibrary
 Class that represents the Win32 dynamic library. More...
 
class  Win32Fiber
 Class that represents the Win32 fiber. More...
 
struct  Win32LParam
 Structure that represents the Win32 LPARAM. More...
 
class  Win32Window
 Class that represents a Win32 window. More...
 
class  Win32WindowClass
 Class that represents the Win32 window class. More...
 
struct  Win32WParam
 Structure that represents the Win32 WPARAM. More...
 

Typedefs

typedef HWND Win32WindowHandle
 Type alias for the native Win32 window handle.
 

Functions

bool addMouseDownEvent (EventQueue &queue, PointerButton buttons, int x, int y, HWND hwnd)
 Adds a mouse button pressed down event.
 
bool addMouseUpEvent (EventQueue &queue, PointerButton buttons, int x, int y)
 Adds a mouse button released event.
 
LRESULT CALLBACK appWindowProcHandler (Win32WindowHandle windowHandle, UINT message, WPARAM wParam, LPARAM lParam)
 Win32 window procedure for receiving messages for the window that was created by the thread.
 
bool attachTouchWindow (const Win32DynamicLibrary &user32Lib, Win32Window &window) noexcept
 Tries to dynamically register the touch input for a window.
 
bool changeToFullscreenWin32Display (const Win32Display &display)
 Changes window mode of the application to full screen on the given Win32 display.
 
bool closeWin32TouchInput (Win32LParam lParam) noexcept
 Closes the touch input handle.
 
bool currentMouseMessageIsFromTouch () noexcept
 Predicate for testing whether the current mouse event originated from a touch device.
 
bool displayWindow (Win32Window &window) noexcept
 Sets a window to be visible and active on the current display.
 
KZ_NO_DISCARD unsigned int findWin32DisplayCount () noexcept
 Finds the number of available active displays.
 
string getLastErrorAsString () noexcept
 Gets the last Win32 error as a printable string.
 
KZ_NO_DISCARD int getMaximumPixelFormatID (const Win32DeviceContext &deviceContext) noexcept
 Gets the maximum allowable pixel format ID.
 
KZ_NO_DISCARD POINT getMousePosition (const Win32Window &window) noexcept
 Gets the mouse position of a window in screen coordinates.
 
KZ_NO_DISCARD PointerButton getTriggeredPointerButtonEvent (UINT message, Win32WParam wParam) noexcept
 Gets the triggered Kanzi mouse button from the Win32 mouse button event.
 
KZ_NO_DISCARD optional< windowing::PositiongetWin32DisplayOrigin (const Win32Display &display)
 Gets the origin of the Win32 display.
 
KZ_NO_DISCARD windowing::SizeU getWin32DisplaySizeU (const Win32Display &display)
 Gets the size of the Win32 display.
 
KZ_NO_DISCARD KeyModifier getWin32KeyModifiers (kanzi::LogicalKey key)
 Gets the currently active key modifiers for a logical key.
 
KZ_NO_DISCARD MONITORINFO getWin32MonitorInfo (HMONITOR monitor) noexcept
 Gets the information about the Win32 monitor.
 
bool getWin32TouchInputInfo (Win32WParam wParam, Win32LParam lParam, TOUCHINPUT &touchInputs) noexcept
 Gets the touch input information.
 
unsigned int getWin32TouchPointCount (Win32WParam wParam) noexcept
 Gets the number of input points for a touch.
 
KZ_NO_DISCARD int getWindowHeight (const Win32Window &window) noexcept
 Gets the window height in screen coordinates.
 
KZ_NO_DISCARD int getWindowPositionX (const Win32Window &window) noexcept
 Gets the window X coordinate in screen coordinates.
 
KZ_NO_DISCARD int getWindowPositionY (const Win32Window &window) noexcept
 Gets the window Y coordinate in screen coordinates.
 
KZ_NO_DISCARD LONG getWindowStyle (const Win32Window &window) noexcept
 Gets the style flags for a window.
 
KZ_NO_DISCARD voidgetWindowUserData (const Win32Window &window) noexcept
 Gets the user data of a window.
 
KZ_NO_DISCARD int getWindowWidth (const Win32Window &window) noexcept
 Gets the window width in screen coordinates.
 
bool hideWindow (Win32Window &window) noexcept
 Makes a window invisible and inactive on the current display.
 
void logActiveDisplays () noexcept
 Prints all available active displays.
 
void logGraphicsFormats () noexcept
 Prints all possible graphics formats by ID to log in CSV format.
 
void logGraphicsFormats (const Win32DeviceContext &deviceContext) noexcept
 Logs all available graphic formats to the standard output.
 
bool makeFullscreenWindow (Win32Window &window, windowing::Position windowOrigin, windowing::SizeU windowSize) noexcept
 Sets a window to full-screen on the current display.
 
bool makeRegularWindow (Win32Window &window) noexcept
 Sets a window to regular on the current display.
 
bool maximizeWindow (Win32Window &window) noexcept
 Maximize a window on the current display.
 
bool minimizeWindow (Win32Window &window) noexcept
 Minimize a window to the taskbar and make it inactive on the current display.
 
bool moveWindow (Win32Window &window, int positionX, int positionY) noexcept
 Moves a window to a new position.
 
void print (const char *format,...) noexcept
 Prints a formatted string to the standard output.
 
void WINAPI processFiberMessages (DefaultFiberContext *fiberData)
 Processes the incoming messages on the Win32 message fiber.
 
void registerWin32TouchInput (const Win32DynamicLibrary &user32Lib) noexcept
 Dynamically registers touch input.
 
bool resizeClientWindowArea (Win32Window &window, int width, int height) noexcept
 Resizes the client-area of a window.
 
bool resizeWindow (Win32Window &window, int width, int height) noexcept
 Resizes a window.
 
bool setWindowStyle (Win32Window &window, LONG windowStyle) noexcept
 Sets the style flags for a window.
 
bool setWindowUserData (Win32Window &window, void *userData) noexcept
 Sets user data for a window.
 
void showMessageBox (const char *format,...) noexcept
 Prints a formatted string in a message window.
 
bool showWindow (Win32Window &window) noexcept
 Set a window to be visible and active on the current display.
 
KZ_NO_DISCARD PointerButton translateWin32ButtonsToKanzi (Win32WParam wParam) noexcept
 Maps the pressed down Win32 mouse buttons to logical mouse buttons used by Kanzi.
 
KZ_NO_DISCARD LogicalKey win32KeyToLogicalKey (Win32WParam wParam, Win32LParam lParam)
 Maps the native Win32 key to a logical key used by Kanzi.
 

Variables

constexpr auto MaximumWin32TouchPointCount
 The maximum number of touch input points.
 

Typedef Documentation

◆ Win32WindowHandle

Type alias for the native Win32 window handle.

Since
Kanzi 3.9.7

Function Documentation

◆ appWindowProcHandler()

LRESULT CALLBACK kanzi::win32::appWindowProcHandler ( Win32WindowHandle windowHandle,
UINT message,
WPARAM wParam,
LPARAM lParam )

Win32 window procedure for receiving messages for the window that was created by the thread.

Parameters
windowHandleThe window for which to receive the message.
messageType of the message.
wParamMessage-specific parameter. Exact meaning depends on the message code.
lParamMessage-specific parameter. Exact meaning depends on the message code.
Returns
The result of handling the received message.

◆ logGraphicsFormats() [1/2]

void kanzi::win32::logGraphicsFormats ( )
noexcept

Prints all possible graphics formats by ID to log in CSV format.

Since
Kanzi 3.9.7

◆ logActiveDisplays()

void kanzi::win32::logActiveDisplays ( )
noexcept

Prints all available active displays.

Since
Kanzi 3.9.7

◆ win32KeyToLogicalKey()

KZ_NO_DISCARD LogicalKey kanzi::win32::win32KeyToLogicalKey ( Win32WParam wParam,
Win32LParam lParam )

Maps the native Win32 key to a logical key used by Kanzi.

Parameters
wParamExtra data for the input key. The data depends on the key.
lParamExtra data for the input key. The data depends on the key.
Since
Kanzi 3.9.7

◆ getWin32KeyModifiers()

KZ_NO_DISCARD KeyModifier kanzi::win32::getWin32KeyModifiers ( kanzi::LogicalKey key)

Gets the currently active key modifiers for a logical key.

Parameters
keyThe logical key from which to extract the modifiers.
Returns
Currently active key modifiers.
Since
Kanzi 3.9.7

◆ getTriggeredPointerButtonEvent()

KZ_NO_DISCARD PointerButton kanzi::win32::getTriggeredPointerButtonEvent ( UINT message,
Win32WParam wParam )
noexcept

Gets the triggered Kanzi mouse button from the Win32 mouse button event.

Parameters
messageThe type of Win32 mouse button event.
wParamThe Win32 button to use for extended buttons.
Returns
Triggered mouse button.
Since
Kanzi 3.9.7

◆ translateWin32ButtonsToKanzi()

KZ_NO_DISCARD PointerButton kanzi::win32::translateWin32ButtonsToKanzi ( Win32WParam wParam)
noexcept

Maps the pressed down Win32 mouse buttons to logical mouse buttons used by Kanzi.

Parameters
wParamThe Win32 button to translate.
Returns
Logical mouse buttons.
Since
Kanzi 3.9.7

◆ currentMouseMessageIsFromTouch()

bool kanzi::win32::currentMouseMessageIsFromTouch ( )
noexcept

Predicate for testing whether the current mouse event originated from a touch device.

Use the predicate in the context when emulated touch input is mixed with real touch input.

Returns
On success, true, otherwise false.
Since
Kanzi 3.9.7

◆ addMouseDownEvent()

bool kanzi::win32::addMouseDownEvent ( EventQueue & queue,
PointerButton buttons,
int x,
int y,
HWND hwnd )

Adds a mouse button pressed down event.

Parameters
queueThe queue to which to add the event.
buttonsThe buttons pressed down for the event.
xX coordinate of the button event. In screen coordinates.
yY coordinate of the button event. In screen coordinates.
hwndThe window that received the mouse button pressed down event.
Since
Kanzi 3.9.7

◆ addMouseUpEvent()

bool kanzi::win32::addMouseUpEvent ( EventQueue & queue,
PointerButton buttons,
int x,
int y )

Adds a mouse button released event.

Parameters
queueThe queue to which to add the event.
buttonsThe buttons released for the event.
xX coordinate of the button event. In screen coordinates.
yY coordinate of the button event. In screen coordinates.
Since
Kanzi 3.9.7

◆ getWin32TouchPointCount()

unsigned int kanzi::win32::getWin32TouchPointCount ( Win32WParam wParam)
noexcept

Gets the number of input points for a touch.

Parameters
wParamWin32 parameter from which to extract the number of input points.
Returns
The number of input points for a touch.
Since
Kanzi 3.9.7

◆ registerWin32TouchInput()

void kanzi::win32::registerWin32TouchInput ( const Win32DynamicLibrary & user32Lib)
noexcept

Dynamically registers touch input.

Parameters
user32LibThe library with which to register the touch input.
Since
Kanzi 3.9.7

◆ getWin32TouchInputInfo()

bool kanzi::win32::getWin32TouchInputInfo ( Win32WParam wParam,
Win32LParam lParam,
TOUCHINPUT & touchInputs )
noexcept

Gets the touch input information.

Parameters
wParamWin32 parameter from which to extract the touch input information.
lParamWin32 parameter from which to extract the touch input information.
touchInputsTouch input that receives the information.
Returns
On success, true. On failure, false.
Since
Kanzi 3.9.7

◆ closeWin32TouchInput()

bool kanzi::win32::closeWin32TouchInput ( Win32LParam lParam)
noexcept

Closes the touch input handle.

Parameters
lParamWin32 parameter from which to extract the touch input handle to close.
Returns
On success, true. On failure, false.
Since
Kanzi 3.9.7

◆ processFiberMessages()

void WINAPI kanzi::win32::processFiberMessages ( DefaultFiberContext * fiberData)

Processes the incoming messages on the Win32 message fiber.

Since
Kanzi 3.9.7

◆ getLastErrorAsString()

string kanzi::win32::getLastErrorAsString ( )
noexcept

Gets the last Win32 error as a printable string.

Returns
The error string.
Since
Kanzi 3.9.7

◆ print()

void kanzi::win32::print ( const char * format,
... )
noexcept

Prints a formatted string to the standard output.

Parameters
formatThe format string.
...The list of parameters to print. The parameters can be empty.
Since
Kanzi 3.9.7

◆ showMessageBox()

void kanzi::win32::showMessageBox ( const char * format,
... )
noexcept

Prints a formatted string in a message window.

Parameters
formatThe format string.
...The list of parameters to print. The parameters can be empty.
Since
Kanzi 3.9.7

◆ logGraphicsFormats() [2/2]

void kanzi::win32::logGraphicsFormats ( const Win32DeviceContext & deviceContext)
noexcept

Logs all available graphic formats to the standard output.

Parameters
deviceContextThe device context for which to log the graphics formats.

◆ getMaximumPixelFormatID()

KZ_NO_DISCARD int kanzi::win32::getMaximumPixelFormatID ( const Win32DeviceContext & deviceContext)
noexcept

Gets the maximum allowable pixel format ID.

Parameters
deviceContextThe device context for which to get the maximum allowable pixel format ID for.
Returns
On success, maximum pixel format index, otherwise 0.

◆ findWin32DisplayCount()

KZ_NO_DISCARD unsigned int kanzi::win32::findWin32DisplayCount ( )
noexcept

Finds the number of available active displays.

Returns
The number of available active displays.

◆ changeToFullscreenWin32Display()

bool kanzi::win32::changeToFullscreenWin32Display ( const Win32Display & display)

Changes window mode of the application to full screen on the given Win32 display.

Parameters
displayThe display to which to change the window mode to full screen.
Returns
On success, true, otherwise false.

◆ getWin32DisplaySizeU()

KZ_NO_DISCARD windowing::SizeU kanzi::win32::getWin32DisplaySizeU ( const Win32Display & display)

Gets the size of the Win32 display.

Parameters
displayThe display for which to get the size.
Returns
The display size. On error, width and height of the display are both 0.

◆ getWin32DisplayOrigin()

KZ_NO_DISCARD optional< windowing::Position > kanzi::win32::getWin32DisplayOrigin ( const Win32Display & display)

Gets the origin of the Win32 display.

Parameters
displayThe display for which to get the origin.
Return values
nulloptGetting the origin failed.
Returns
The display origin.

◆ getWin32MonitorInfo()

KZ_NO_DISCARD MONITORINFO kanzi::win32::getWin32MonitorInfo ( HMONITOR monitor)
noexcept

Gets the information about the Win32 monitor.

Parameters
monitorThe monitor for which to get the information.
Returns
The Win32 monitor information.
Since
Kanzi 3.9.7

◆ resizeClientWindowArea()

bool kanzi::win32::resizeClientWindowArea ( Win32Window & window,
int width,
int height )
noexcept

Resizes the client-area of a window.

Parameters
windowWindow whose client-area to resize.
widthWidth to which to resize.
heightHeight to which to resize.
Returns
On success, true, otherwise false.

◆ resizeWindow()

bool kanzi::win32::resizeWindow ( Win32Window & window,
int width,
int height )
noexcept

Resizes a window.

Parameters
windowWindow to resize.
widthWidth to which to resize.
heightHeight to which to resize.
Returns
On success, true, otherwise false.

◆ moveWindow()

bool kanzi::win32::moveWindow ( Win32Window & window,
int positionX,
int positionY )
noexcept

Moves a window to a new position.

Parameters
windowWindow to move.
positionXThe horizontal position of the top-left corner of the window in screen coordinates.
positionYThe vertical position of the top-left corner of the window in screen coordinates.
Returns
On success, true, otherwise false.

◆ makeFullscreenWindow()

bool kanzi::win32::makeFullscreenWindow ( Win32Window & window,
windowing::Position windowOrigin,
windowing::SizeU windowSize )
noexcept

Sets a window to full-screen on the current display.

Parameters
windowWindow to set to full-screen.
windowOriginWindow origin in pixels.
windowSizeWindow size in pixels.
Returns
On success, true, otherwise false.

◆ makeRegularWindow()

bool kanzi::win32::makeRegularWindow ( Win32Window & window)
noexcept

Sets a window to regular on the current display.

Parameters
windowWindow to set to regular.
Returns
On success, true, otherwise false.

◆ displayWindow()

bool kanzi::win32::displayWindow ( Win32Window & window)
noexcept

Sets a window to be visible and active on the current display.

If the window is minimized or maximized, restores the original size and position of the window.

Parameters
windowWindow to display.
Returns
On success, true, otherwise false.

◆ showWindow()

bool kanzi::win32::showWindow ( Win32Window & window)
noexcept

Set a window to be visible and active on the current display.

Parameters
windowWindow to show.
Returns
On success, true, otherwise false.

◆ hideWindow()

bool kanzi::win32::hideWindow ( Win32Window & window)
noexcept

Makes a window invisible and inactive on the current display.

Parameters
windowWindow to hide.
Returns
On success, true, otherwise false.

◆ maximizeWindow()

bool kanzi::win32::maximizeWindow ( Win32Window & window)
noexcept

Maximize a window on the current display.

Parameters
windowWindow to maximize.
Returns
On success, true, otherwise false.

◆ minimizeWindow()

bool kanzi::win32::minimizeWindow ( Win32Window & window)
noexcept

Minimize a window to the taskbar and make it inactive on the current display.

Parameters
windowWindow to minimize.
Returns
On success, true, otherwise false.

◆ getWindowWidth()

KZ_NO_DISCARD int kanzi::win32::getWindowWidth ( const Win32Window & window)
noexcept

Gets the window width in screen coordinates.

Parameters
windowWindow for which to retrieve the width.
Returns
The window width.

◆ getWindowHeight()

KZ_NO_DISCARD int kanzi::win32::getWindowHeight ( const Win32Window & window)
noexcept

Gets the window height in screen coordinates.

Parameters
windowWindow for which to retrieve the height.
Returns
The window height.

◆ getWindowPositionX()

KZ_NO_DISCARD int kanzi::win32::getWindowPositionX ( const Win32Window & window)
noexcept

Gets the window X coordinate in screen coordinates.

Parameters
windowWindow for which to retrieve the X coordinate.
Returns
The X coordinate of the window.

◆ getWindowPositionY()

KZ_NO_DISCARD int kanzi::win32::getWindowPositionY ( const Win32Window & window)
noexcept

Gets the window Y coordinate in screen coordinates.

Parameters
windowWindow for which to retrieve the Y coordinate.
Returns
The Y coordinate of the window.

◆ setWindowUserData()

bool kanzi::win32::setWindowUserData ( Win32Window & window,
void * userData )
noexcept

Sets user data for a window.

Parameters
windowWindow for which to set the user data.
userDataUser data to set.
Returns
On success, true, otherwise false.

◆ getWindowUserData()

KZ_NO_DISCARD void * kanzi::win32::getWindowUserData ( const Win32Window & window)
noexcept

Gets the user data of a window.

Parameters
windowWindow for which to get the user data.
Returns
The user data of the window.

◆ setWindowStyle()

bool kanzi::win32::setWindowStyle ( Win32Window & window,
LONG windowStyle )
noexcept

Sets the style flags for a window.

Parameters
windowWindow for which to set the style flags.
windowStyleThe style flags to set.
Returns
On success, true, otherwise false.

◆ getWindowStyle()

KZ_NO_DISCARD LONG kanzi::win32::getWindowStyle ( const Win32Window & window)
noexcept

Gets the style flags for a window.

Parameters
windowWindow for which to get the style flags.
Returns
The style flags of the window.

◆ getMousePosition()

KZ_NO_DISCARD POINT kanzi::win32::getMousePosition ( const Win32Window & window)
noexcept

Gets the mouse position of a window in screen coordinates.

Returns
The mouse position of a window in screen coordinates.

◆ attachTouchWindow()

bool kanzi::win32::attachTouchWindow ( const Win32DynamicLibrary & user32Lib,
Win32Window & window )
noexcept

Tries to dynamically register the touch input for a window.

Parameters
user32LibLibrary with which to register the window.
windowWindow for which to register the touch input.
Returns
On success, true, otherwise false.

Variable Documentation

◆ MaximumWin32TouchPointCount

constexpr auto kanzi::win32::MaximumWin32TouchPointCount
constexpr

The maximum number of touch input points.

Since
Kanzi 3.9.7