A small Win32 application written in JavaScript, in the style of a Python ctypes GUI script: menu bar, toolbar and status bar, a tab control with the common controls, a file browser and date/time controls, a task dialog, a notification area icon and a Windows 11 title bar.
Platform: Windows · Demo: demo_controls.js
node examples/windows/controls/demo_controls.js
Interact with the window: events are printed to the console. Closing the window (or File → Exit) ends the message loop.
Polygon, Polyline, DrawTextW), double-buffered with a memory bitmap and BitBlt.IsDialogMessageW); Enter presses the default button. Right-click opens a context menu.WM_GETMINMAXINFO keeps the window at least one column wide; the controls move together with DeferWindowPos.TVN_ITEMEXPANDINGW), and a virtual ListView (LVS_OWNERDATA): only the item count is sent, each visible cell is written into the list view's own buffer on LVN_GETDISPINFOW. Folders are read with FindFirstFileW / FindNextFileW.SHGetFileInfoW), the controls use the Explorer theme (SetWindowTheme). Click a column header to sort (with the arrow in the header), double-click a folder to open it, right-click for the view modes.DragAcceptFiles, WM_DROPFILES; ChangeWindowMessageFilterEx lets them through when the process is elevated). File → Browse opens the folder dialog (SHBrowseForFolderW).A date picker, a time picker and a month calendar kept in sync (DTN_DATETIMECHANGE, MCN_SELCHANGE), with the selection formatted by GetDateFormatEx / GetTimeFormatEx in the user's locale.
CreateAcceleratorTableW, TranslateAcceleratorW).SHGetStockIconInfo in the system image list; "Animate" is a check button kept in sync with the checkbox and the menu.TaskDialogIndirect with command links, radio buttons, a verification checkbox, expandable details and a footer link. Its progress bar is driven by a JavaScript callback (TDN_TIMER); "Restart the progress" keeps the dialog open by returning S_FALSE. Help → About uses TaskDialog and RtlGetVersion.Shell_NotifyIconW with NOTIFYICON_VERSION_4; click it to restore the window, right-click for a menu. A notification appears when the animation reaches 100, from Tools → Show a notification, or when the task dialog closes with its checkbox selected.node.exe has no manifest requesting Common Controls 6, so the demo activates the one embedded in shell32.dll (resource 124) with CreateActCtxW / ActivateActCtx before loading comctl32.dll. Without it the controls are drawn in the classic style, and task dialogs are unavailable.SetProcessDpiAwarenessContext). The layout is defined at 96 DPI and scaled with GetDpiForWindow, the font is the system message font for that DPI (SystemParametersInfoForDpi), and WM_DPICHANGED rescales everything when the window moves to a monitor with another scale.AppsUseLightTheme, read with RegGetValueW, updated on WM_SETTINGCHANGE), with the Mica backdrop (DwmSetWindowAttribute); both can be toggled from the View menu. The controls themselves keep the light theme.WINFUNCTYPE window procedures (three window classes) and a task dialog callback · structures with one-byte packing (_pack_ = 1) and Union fields (TASKDIALOGCONFIG) · nested structures (NONCLIENTMETRICSW, NMTREEVIEWW, NOTIFYICONDATAW with its GUID) and WCHAR array fields assigned from strings · arrays of structures (TBBUTTON, ACCEL, POINT, TASKDIALOG_BUTTON) · notifications read with cast(lParam, POINTER(NMHDR)).contents, and written back through the same view (MINMAXINFO, NMLVDISPINFOW) · memmove into a buffer owned by Windows · addressof() for strings referenced by address · typed prototypes for the same export (WINFUNCTYPE(...)(["SendMessageW", user32])) · wstring_at() · c_wchar_p fields kept alive with the structure · use_last_error with WinError(get_last_error())
All the structure sizes match the Windows SDK headers on 64-bit Windows.