Component reference

Code and result,
side by side.

Every wrapper owns or observes a real Windows object. The concise path is shown first; native handles, messages, styles, and return values remain available.

Search the complete component catalog

Foundation

Application

Creates the stack-owned main window, runs the message loop, and guarantees cleanup.

int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show) {
    return mwfl::RunApplication<MainWindow>(instance, show);
}
No application subclass.Failures become non-zero process exit codes. Exceptions are contained before crossing wWinMain.
Foundation

Window

Derive from WindowBase and override only the typed events the application needs.

class MainWindow final : public mwfl::WindowBase {
public:
    void BuildUI() override {
        SetTitle(L"My app");
    }

    mwfl::EventResult OnKeyDown(const mwfl::KeyEvent& event) override {
        if (event.virtual_key == VK_ESCAPE) Close();
        return mwfl::EventResult::Handled();
    }
};
mwfl Hello native window
A real Unicode, Per-Monitor V2 HWND window.
Foundation

Timer

A move-only RAII timer with chrono intervals and typed IDs.

heartbeat_.Start(*this, {1}, 1s);

mwfl::EventResult OnTimer(mwfl::TimerId id) override {
    status_.SetText(L"Tick");
    return mwfl::EventResult::Handled();
}
Foundation

Desktop integration

Owned native menus and accelerators, custom modal/modeless forms, system file/folder dialogs, Unicode clipboard, shell drops, persistent placement, DPI fonts, and focus navigation.

mwfl::Menu bar, file;
bar.Create();
file.CreatePopup();
file.AppendCommand(100, L"Open\tCtrl+O");
bar.AppendSubmenu(std::move(file), L"File");
bar.AttachToWindow(GetHwnd());

const auto picked = mwfl::ShowOpenFileDialog({.owner = GetHwnd()});
if (picked.accepted) Open(picked.path);

mwfl::Dialog form({.owner = GetHwnd(), .title = L"Profile"});
const auto result = form.ShowModal();
Reference utility

Multi-monitor Hot Corners

A complete notification-area utility with stable-GUID tray lifetime, typed context commands, notifications, Explorer restart recovery, and topology-aware outer corners across the virtual desktop.

EnumDisplayMonitors(nullptr, nullptr, CollectMonitor, data);
GetCursorPos(&cursor);

const auto hit = hot_corners::Detect(cursor, monitors, 2);
const auto fired = dwell.Update(hit, GetTickCount64(), 350);
if (fired) Activate(*fired);

if (tray_.IsTaskbarCreated(message)) tray_.Recreate();
else if (auto event = tray_.Decode(message)) RouteTray(*event);
mwfl multi-monitor Hot Corners utility
Only exposed outer corners activate; internal display seams are disabled while true step corners remain available.
Reference application

Explorer-style shell

A complete native composition: Rebar and image-backed Toolbar, stable Tabs, keyboard Splitter, TreeView navigation, owner-data ListView, responsive StatusBar, accelerators, and context commands.

mwfl::ControlHost panes{splitter_};
panes.Add(tree_, {204}, {});
panes.Add(list_, {205}, {},
    mwfl::ListViewOptions{.virtual_data = true});
splitter_.AttachPanes(tree_.GetHwnd(), list_.GetHwnd());

list_.SetVirtualModel(model_);
SetLayout(mwfl::Column()
    .Add(rebar_, mwfl::Auto())
    .Add(tabs_, mwfl::Fixed(34.0_dip))
    .Add(splitter_, mwfl::Stretch())
    .Add(status_, mwfl::Auto()));
Owner-data notifications still reach the window. Splitter forwards attached-pane notifications, commands, and context menus to its parent with the original result.
Basic controls

Native form controls

Label, Button, TextBox, CheckBox, RadioButton, GroupBox, ComboBox, ListBox, ProgressBar, Slider, and ScrollBar.

mwfl::ControlHost ui{*this};
ui.Add(name_, L"mwfl developer");
ui.Add(greet_, L"Say hello");
ui.Add(enabled_, L"Button enabled");
ui.Add(accent_);
ui.Add(progress_);

mwfl::Must(mwfl::AddItems(
    accent_, {L"Sky blue", L"Graphite", L"Forest"}));
progress_.SetRange(0, 100);
progress_.SetValue(64);
mwfl native form controls example
System controls retain native keyboard, IME, accessibility, and theme behavior.
Basic controls

Command events

Match the originating control without message-map macros or manual HWND comparisons.

mwfl::EventResult OnCommand(const mwfl::CommandEvent& event) override {
    if (event.IsClicked(greet_)) {
        status_.SetText(L"Hello, " + name_.GetText());
        return mwfl::EventResult::Handled();
    }
    return mwfl::EventResult::Propagate();
}
Complete coverage

All 27 native controls

Every public child-control wrapper is shown with current creation code, its native result, and a link to the executable example that exercises it.

ComboBox in the controls example

ComboBox

ui.Add(combo_);
SelectionAdapter<ComboBox, ThemeId> themes{combo_};
themes.Add(L"Dark", ThemeId::dark);
Controls example
Common Controls

Data and navigation

TreeView, ListView, Header, TabControl, and ComboBoxEx.

mwfl::ControlHost ui{*this};
ui.Add(tree_);
ui.Add(list_, ListViewOptions{.virtual_data = true});

const auto root = tree_.AddItem({101}, L"Common Controls");
tree_.AddChild({102}, L"Navigation", {101});
tree_.Expand({101});

mwfl::Must(mwfl::AddColumns(list_, {
    {L"Control", 170},
    {L"Ownership", 150},
}));
list_.SetVirtualModel(model_);
list_.SetSelected({302});
// Route WM_NOTIFY through HandleNotification.
Complete Windows Common Controls gallery
The complete populated gallery. Continue below for the other families.
Common Controls

Date and input

DateTimePicker, MonthCalendar, HotKey, IpAddress, UpDown, and SysLink.

mwfl::ControlHost ui{*this};
ui.Add(date_);
ui.Add(calendar_);
ui.Add(hot_key_);
ui.Add(ip_);
ui.Add(spin_);

hot_key_.SetValue('K', HOTKEYF_CONTROL | HOTKEYF_ALT);
ip_.SetValue(127, 0, 0, 1);
spin_.SetBuddy(number_);
spin_.SetRange(0, 100);
Common Controls

Commands and containers

Toolbar, StatusBar, Rebar, Pager, and Animation.

mwfl::ControlHost ui{*this};
ui.Add(rebar_, {200}, rebar_bounds);
mwfl::ControlHost band{rebar_};
band.Add(toolbar_, {201}, toolbar_bounds);
mwfl::Must(mwfl::AddButtons(
    toolbar_, {{{500}, L"Task Dialog"}}));
toolbar_.AutoSize();
rebar_.AddBand(toolbar_, L"", 360);

ui.Add(status_, {219}, status_bounds);
status_.SetParts({700, 980, -1});
mwfl::Must(mwfl::SetPartTexts(
    status_, {{0, L"Native controls ready"}}));
Responsive layout

Rows, columns, and overlays

Compose DPI-aware layouts with margins, gaps, fixed, automatic, and weighted stretch tracks. The window rearranges attached controls on every resize.

using mwfl::operator""_dip;

SetLayout(
    mwfl::Column()
        .Margin(16.0_dip)
        .Gap(10.0_dip)
        .Add(title_, mwfl::Auto())
        .Add(
            mwfl::Row()
                .Gap(8.0_dip)
                .Add(name_, mwfl::Stretch())
                .Add(greet_, mwfl::Fixed(100.0_dip)),
            mwfl::Stretch())
        .Add(status_, mwfl::Auto()));
Reference application

Persistent Settings

Two resizable native property pages with stable IDs, dirty tracking, validation, task-dialog feedback, Apply/OK/Cancel, and a versioned per-user registry schema.

auto candidate = committed_;
candidate.display_name = name_.GetText();

const auto saved = SaveSettings(
    HKEY_CURRENT_USER, settings_key, candidate);
if (!saved.Succeeded()) {
    ShowTaskDialog(page, L"Settings were not saved", ...);
    return false; // keep the page dirty
}
committed_ = std::move(candidate);
return true;
Cancel is predictable. Controls are an editable projection, not the source of truth. Each page's reset callback restores the last committed value.
Common Controls

Resources and dialogs

Owned ImageList with explicit toolbar borrowing, owned/updateable Tooltip text with borrowed tools, structured popup-menu results, modal TaskDialog, and Flat Scroll Bar integration.

images_.Create(16, 16);
images_.AddIcon(::LoadIconW(nullptr, IDI_INFORMATION));

tooltip_.Create(GetHwnd(), {.balloon = true, .max_width = 320});
tooltip_.AddTool(button_.GetHwnd(), L"Native tooltip");
tooltip_.UpdateTool(button_.GetHwnd(), L"Updated text owned by Tooltip");

const auto selected = popup_.TrackResult(GetHwnd(), screen_point);
if (selected) PostMessageW(GetHwnd(), WM_COMMAND, selected.command, 0);

const auto result = mwfl::ShowTaskDialog(
    GetHwnd(), L"mwfl", L"Native Task Dialog", L"Real Common Controls UI.");
Need more Win32? Call ::SendMessageW(control.GetHwnd(), ...). Thin wrappers do not close the native API surface.