--- title: Documentation – dialog-layout --- {% include head.html %} {% include header.html %}

Documentation

API Reference

Installation

  1. Add dialog-layout to your project using CMake or by copying layout.h and layout.c.
  2. Include the header: #include "layout.h"
  3. Compile and link with layout.c in your sources.

Usage

  1. Create your Win32 dialog resource as usual in your .rc file.
  2. Create a layout resource (.bin, using the documented format) and add it as an RCDATA resource.
  3. In your dialog procedure:
    attach_layout(GetModuleHandle(NULL), hDlg, _T("MY_DIALOG_LAYOUT")); // in WM_INITDIALOG 
    detach_layout(hDlg); // in WM_DESTROY
            

Layout Resource Format

Each layout item is a struct:

typedef struct {
  DWORD id;
  WORD top_left_anchor;
  WORD bottom_right_anchor;
} LAYOUT_ITEM_RC;
      

See examples for a generator script and sample anchor setup.

{% include footer.html %}