xtd 0.2.0
xtd::forms::message Struct Reference
Inheritance diagram for xtd::forms::message:
xtd::object xtd::iequatable< message > xtd::interface xtd::extensions::equality_operators< type_t, equatable_t >

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
 Gets or sets the window handle of the message.
 
uint32 msg
 Gets or sets the ID number for the message.
 
intptr wparam
 Gets or sets the wparam field of the message.
 
intptr lparam
 Sets the lparam field of the message.
 
intptr result
 Gets or sets the value that is returned to Windows in response to handling the message.
 
intptr __handle__
 Gets or sets the handle field of the message.
 

Public Methods

bool equals (const xtd::object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const message &other) const noexcept override
 Determines whether the specified object is equal to the current object.
 
xtd::size get_hash_code () const noexcept override
 Serves as a hash function for a particular type.
 
template<class 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 type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< message >
virtual bool equals (const message &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<class object_a_t , class 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<class object_a_t , class 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

◆ equals() [1/2]

bool xtd::forms::message::equals ( const xtd::object obj) const
overridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.

Reimplemented from xtd::object.

◆ equals() [2/2]

bool xtd::forms::message::equals ( const message other) const
overridenoexcept

Determines whether the specified object is equal to the current object.

Parameters
otherThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.

◆ get_hash_code()

xtd::size xtd::forms::message::get_hash_code ( ) const
overridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ get_lparam()

template<class 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.

Member Data Documentation

◆ hwnd

intptr xtd::forms::message::hwnd

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

◆ msg

uint32 xtd::forms::message::msg

Gets or sets the ID number for the message.

Parameters
msgThe ID number for the message.
Examples
application_add_message_filter.cpp, and form_and_messages.cpp.

◆ wparam

intptr xtd::forms::message::wparam

Gets or sets the wparam field of the message.

Parameters
wparamThe 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.

◆ lparam

intptr xtd::forms::message::lparam

Sets the lparam field of the message.

Parameters
lparamThe 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.

◆ result

intptr xtd::forms::message::result

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

Parameters
resultThe return value of the message.

◆ __handle__

intptr xtd::forms::message::__handle__

Gets or sets the handle field of the message.

Parameters
handleThe handle field of the message.
Warning
Internal use only

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