xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Member Functions | Static Public Member Functions | List of all members
xtd::forms::message Class Reference

#include <message.h>

Definition

Implements a Windows message.

Namespace
xtd::forms
Library
xtd.forms
Remarks
The message structure wraps messages that Windows sends. You can use this structure to wrap a message and assign it to the window procedure to be dispatched. You can also use this structure to get information about a message the system sends to your application or controls.
You cannot create the message directly. Instead, use the create method. For the sake of efficiency, the message uses its pool of existing Messages instead of instantiating a new one, if possible. However, if a message is not available in the pool, a new one is instantiated.
Windows message are simulate on macOS and linux.

Inherits xtd::object.

Public Member Functions

template<typename type >
type get_lparam ()
 Gets the lparam value and converts the value to an object. More...
 
intptr_t hwnd () const
 Gets the window handle of the message. More...
 
void hwnd (intptr_t value)
 Sets the window handle of the message. More...
 
intptr_t lparam () const
 Gets the lparam field of the message. More...
 
void lparam (intptr_t value)
 Sets the lparam field of the message. More...
 
int32_t msg () const
 Gets the ID number for the message. More...
 
void msg (int32_t value)
 Sets the ID number for the message. More...
 
intptr_t result () const
 Gets the value that is returned to Windows in response to handling the message. More...
 
void result (intptr_t value)
 Sets the value that is returned to Windows in response to handling the message. More...
 
xtd::ustring to_string () const noexcept override
 Returns a string that represents the current message. More...
 
intptr_t wparam () const
 Gets the wparam field of the message. More...
 
void wparam (intptr_t value)
 Sets the wparam field of the message. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 

Static Public Member Functions

static message create (intptr_t hwnd, int32_t msg, intptr_t wparam, intptr_t lparam)
 Creates a new message. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Member Function Documentation

◆ create()

static message xtd::forms::message::create ( intptr_t  hwnd,
int32_t  msg,
intptr_t  wparam,
intptr_t  lparam 
)
inlinestatic

Creates a new message.

Parameters
hwndThe window handle that the message is for.
msgThe message ID.The message ID.
wparamThe message wparam field.
lparamThe message lparam field.
Returns
A xtd::forms::message that represents the message that was created.
Remarks
Use the xtd::message::create method to create a xtd::forms::message to wrap a message sent by Windows.

◆ get_lparam()

template<typename type >
type xtd::forms::message::get_lparam ( )
inline

Gets the lparam value and converts the value to an object.

Template Parameters
typeThe type to use to create an instance. This type must be declared as a structure type.
Returns
An object that represents an instance of the class specified by the template parameter, with the data from the lparam field of the message.

◆ hwnd() [1/2]

intptr_t xtd::forms::message::hwnd ( ) const
inline

Gets the window handle of the message.

Returns
The window handle of the message.
Remarks
Window handle is a value that uniquely identifies a window on the system. This property returns a handle of the window whose window procedure receives this message. It is useful when your code need to interact with some native Windows API functions that expect window handles as parameters.

◆ hwnd() [2/2]

void xtd::forms::message::hwnd ( intptr_t  value)
inline

Sets the window handle of the message.

Parameters
hwndThe window handle of the message.
Remarks
Window handle is a value that uniquely identifies a window on the system. This property returns a handle of the window whose window procedure receives this message. It is useful when your code need to interact with some native Windows API functions that expect window handles as parameters.

◆ lparam() [1/2]

intptr_t xtd::forms::message::lparam ( ) const
inline

Gets the lparam field of the message.

Returns
The lparam field of the message.
Remarks
The value of this field depends on the message. Use the lparam field to get information that is important for handling the message. lparam is typically used to store an object if it is needed by the message.

◆ lparam() [2/2]

void xtd::forms::message::lparam ( intptr_t  value)
inline

Sets the lparam field of the message.

Parameters
valueThe lparam field of the message.
Remarks
The value of this field depends on the message. Use the lparam field to get information that is important for handling the message. lparam is typically used to store an object if it is needed by the message.

◆ msg() [1/2]

int32_t xtd::forms::message::msg ( ) const
inline

Gets the ID number for the message.

Returns
The ID number for the message.

◆ msg() [2/2]

void xtd::forms::message::msg ( int32_t  value)
inline

Sets the ID number for the message.

Parameters
valueThe ID number for the message.

◆ result() [1/2]

intptr_t xtd::forms::message::result ( ) const
inline

Gets the value that is returned to Windows in response to handling the message.

Returns
The return value of the message.

◆ result() [2/2]

void xtd::forms::message::result ( intptr_t  value)
inline

Sets the value that is returned to Windows in response to handling the message.

Parameters
valueThe return value of the message.

◆ to_string()

xtd::ustring xtd::forms::message::to_string ( ) const
overridevirtualnoexcept

Returns a string that represents the current message.

Returns
A xtd::ustring that represents the current message.

Reimplemented from xtd::object.

◆ wparam() [1/2]

intptr_t xtd::forms::message::wparam ( ) const
inline

Gets the wparam field of the message.

Returns
The wparam field of the message.
Remarks
The value of this field depends on the message. Use the wparam field to get information that is important to handling the message. This field is typically used to store small pieces of information, such as flags.

◆ wparam() [2/2]

void xtd::forms::message::wparam ( intptr_t  value)
inline

Sets the wparam field of the message.

Parameters
valueThe wparam field of the message.
Remarks
The value of this field depends on the message. Use the wparam field to get information that is important to handling the message. This field is typically used to store small pieces of information, such as flags.

The documentation for this class was generated from the following file: