Skip to content

ui::NativeNotification

Header: winui/render/NativeHost.hpp.

A Win32 message a hosted window sent its parent about itself (WM_COMMAND, WM_NOTIFY, WM_CTLCOLOR* and a scroll bar's or trackbar's WM_HSCROLL/WM_VSCROLL), handed to the element that owns the window by NativeControl::handle_native_notification(). Windows only, like NativeControlDesc, and plain integers for the same reason: wparam and lparam are the message's own, and result is what the parent's window procedure returns when the element handled it (a brush for WM_CTLCOLOR*, a notification's return value).

Example:

class MyTrackbar : public ui::NativeControl
{
public:
    bool handle_native_notification(ui::NativeNotification& n) override
    {
        if (n.message != 0x0114 /*WM_HSCROLL*/)
        {
            return false;
        }
        position_changed(read_position());
        n.result = 0;
        return true;
    }

private:
    int  read_position() const;
    void position_changed(int position);
};

Field Type Default
message std::uint32_t 0 The message id (WM_COMMAND, WM_NOTIFY, ...).
wparam std::uintptr_t 0 The message's WPARAM.
lparam std::intptr_t 0 The message's LPARAM.
result std::intptr_t 0 What the parent returns when the element handled it.