xtd 0.2.0
Loading...
Searching...
No Matches
xtd::forms::message Class Reference
Inheritance diagram for xtd::forms::message:
xtd::object

Definition

Implements a Windows message.

Header
#include <xtd/forms/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.
Examples
action1.cpp, action2.cpp, action3.cpp, application_add_message_filter.cpp, form_and_messages.cpp, and wnd_proc.cpp.

Public Properties

intptr hwnd () const noexcept
 Gets the window handle of the message.
 
void hwnd (intptr value)
 Sets the window handle of the message.
 
intptr lparam () const noexcept
 Gets the lparam field of the message.
 
void lparam (intptr value)
 Sets the lparam field of the message.
 
uint32 msg () const noexcept
 Gets the ID number for the message.
 
void msg (uint32 value)
 Sets the ID number for the message.
 
intptr result () const noexcept
 Gets the value that is returned to Windows in response to handling the message.
 
void result (intptr value)
 Sets the value that is returned to Windows in response to handling the message.
 
intptr wparam () const noexcept
 Gets the wparam field of the message.
 
void wparam (intptr value)
 Sets the wparam field of the message.
 

Public Methods

template<typename type_t >
type_t get_lparam () const noexcept
 Gets the lparam value and converts the value to an object.
 
xtd::string to_msg_string () const noexcept
 Returns a string that represents the msg property.
 
xtd::string to_string () const noexcept override
 Returns a string that represents the current message.
 

Public Static Methods

static message create (intptr hwnd, int32 msg, intptr wparam, intptr lparam)
 Creates a new message.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Function Documentation

◆ hwnd() [1/2]

intptr xtd::forms::message::hwnd ( ) const
noexcept

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.
Examples
application_add_message_filter.cpp.

◆ hwnd() [2/2]

void xtd::forms::message::hwnd ( intptr  value)

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 xtd::forms::message::lparam ( ) const
noexcept

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.
Examples
form_and_messages.cpp.

◆ lparam() [2/2]

void xtd::forms::message::lparam ( intptr  value)

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]

uint32 xtd::forms::message::msg ( ) const
noexcept

Gets the ID number for the message.

Returns
The ID number for the message.
Examples
application_add_message_filter.cpp, and form_and_messages.cpp.

◆ msg() [2/2]

void xtd::forms::message::msg ( uint32  value)

Sets the ID number for the message.

Parameters
valueThe ID number for the message.

◆ result() [1/2]

intptr xtd::forms::message::result ( ) const
noexcept

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  value)

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

Parameters
valueThe return value of the message.

◆ wparam() [1/2]

intptr xtd::forms::message::wparam ( ) const
noexcept

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.
Examples
form_and_messages.cpp.

◆ wparam() [2/2]

void xtd::forms::message::wparam ( intptr  value)

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.

◆ get_lparam()

template<typename type_t >
type_t xtd::forms::message::get_lparam ( ) const
inlinenoexcept

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.

◆ to_msg_string()

xtd::string xtd::forms::message::to_msg_string ( ) const
noexcept

Returns a string that represents the msg property.

Returns
A xtd::string that represents the msg property.

◆ to_string()

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

Returns a string that represents the current message.

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

Reimplemented from xtd::object.

◆ create()

static message xtd::forms::message::create ( intptr  hwnd,
int32  msg,
intptr  wparam,
intptr  lparam 
)
static

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.

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