uLib  User mode C/C++ extended API library for Win32 programmers.
Dialog Template Functions

Module Description

Dialog memory templates support.
#include <uLib/DlgPlate.h>

This is by far the most finicky way to create a dialog...
However, it's purely code, so it can live without resources, such as in a lib.
After creating a memory dialog template, use f.ex. DialogBoxIndirectParam(),
passing the template pointer as your hDialogTemplate argument.

Hint: Memory templates are indispensable if you want to write a dialog editor.

Classes

struct  DLGTEMPLATEEX
 
struct  DLGITEMTEMPLATEEX
 

Macros

#define ORD_BUTTON   0x0080ffff
 
#define ORD_EDIT   0x0081ffff
 
#define ORD_STATIC   0x0082ffff
 
#define ORD_LISTBOX   0x0083ffff
 
#define ORD_SCROLLBAR   0x0084ffff
 
#define ORD_COMBOBOX   0x0085ffff
 

Typedefs

typedef DLGTEMPLATEEXPDLGTEMPLATEEX
 
typedef DLGITEMTEMPLATEEXPDLGITEMTEMPLATEEX
 

Functions

LPDLGTEMPLATE AllocDlgTemplate (WORD Size)
 
void FreeDlgTemplate (LPDLGTEMPLATE pDlg)
 
LPDLGITEMTEMPLATE SetDlgStyle (LPDLGTEMPLATE pBuf, DWORD Style, short X, short Y, short W, short H, LPCWSTR Caption, WORD nCtls, LPCWSTR Font, WORD Points)
 
LPDLGITEMTEMPLATE AddDlgItem (LPDLGITEMTEMPLATE pBuf, DWORD Type, DWORD Style, DWORD ExStyle, short X, short Y, short W, short H, LPCWSTR Caption, WORD Id)
 
PDLGTEMPLATEEX AllocExDlgTemplate (WORD Size)
 
void FreeExDlgTemplate (PDLGTEMPLATEEX pDlg)
 
PDLGITEMTEMPLATEEX SetExDlgStyle (PDLGTEMPLATEEX pBuf, DWORD Style, short X, short Y, short W, short H, LPCWSTR Caption, DWORD HelpId, WORD nCtls, LPCWSTR Font, short Points, short Weight=FW_NORMAL, BYTE CharSet=DEFAULT_CHARSET)
 
PDLGITEMTEMPLATEEX AddExDlgItem (PDLGITEMTEMPLATEEX pBuf, DWORD Type, DWORD Style, DWORD ExStyle, short X, short Y, short W, short H, LPCWSTR Caption, WORD Id, DWORD HelpId)
 

Class Documentation

◆ DLGTEMPLATEEX

struct DLGTEMPLATEEX

Everything after cy in DLGTEMPLATEEX is variable length,
and therefore must be determined dynamically..

  • wsz_Or_Ord menu; // Name or ordinal of a menu resource. 0x0000 = No menu.
  • wsz_Or_Ord windowClass; // Name or ordinal of a window class. 0x0000 = Std dialog class.
  • WCHAR title[titleLen]; // Title string of the dialog box.
  • short pointsize; // Font size. (Only if DS_SETFONT or DS_SHELLFONT is set).
  • short weight; // Font weight. (dito)
  • uchar bItalic; // Font slant. (dito)
  • uchar charSet; // Font charset. (dito)
  • WCHAR font[fontLen]; // Typeface name, if DS_SETFONT is set.

See [MSDN] DLGTEMPLATEEX Structure for further details.

Definition at line 98 of file DlgPlate.h.

Class Members
WORD dlgVer

Must be 1.

WORD signature

0xFFFF.

DWORD helpId

Help context id.

DWORD exStyle

Unused... Or is it, by now? Do some tests?

DWORD style

Dialog style, DS_nn and WS_nn flags.

WORD cDlgItems

Nr of DLGITEMTEMPLATEEX structs following.

short x

X position in dialog units.

short y

Y position in dialog units.

short cx

Width in dialog units.

short cy

Height in dialog units.

◆ DLGITEMTEMPLATEEX

struct DLGITEMTEMPLATEEX

Everything after id in DLGITEMTEMPLATEEX is variable length,
and therefore must be determined dynamically

  • wsz_Or_Ord ctrlClass; // Name or ordinal (e.g ORD_EDIT) of a control class
  • wsz_Or_Ord title; // Title string or ordinal of a resource
  • WORD extraCount; // Bytes following creation data

See [MSDN] DLGITEMTEMPLATEEX Structure for further details.

Definition at line 126 of file DlgPlate.h.

Class Members
DWORD helpId

Help context identifier for the contro.

DWORD exStyle

Extended styles for the control.

DWORD style

Window style flags for the control.

short x

X position in dialog units.

short y

Y position in dialog units.

short cx

Width in dialog units.

short cy

Height in dialog units.

DWORD id

Dialog item Id.

Macro Definition Documentation

◆ ORD_BUTTON

#define ORD_BUTTON   0x0080ffff

Button (composite LE ordinal).

Definition at line 29 of file DlgPlate.h.

◆ ORD_EDIT

#define ORD_EDIT   0x0081ffff

Edit (composite LE ordinal).

Definition at line 30 of file DlgPlate.h.

◆ ORD_STATIC

#define ORD_STATIC   0x0082ffff

Static (composite LE ordinal).

Definition at line 31 of file DlgPlate.h.

◆ ORD_LISTBOX

#define ORD_LISTBOX   0x0083ffff

List box (composite LE ordinal).

Definition at line 32 of file DlgPlate.h.

◆ ORD_SCROLLBAR

#define ORD_SCROLLBAR   0x0084ffff

Scroll bar (composite LE ordinal).

Definition at line 33 of file DlgPlate.h.

◆ ORD_COMBOBOX

#define ORD_COMBOBOX   0x0085ffff

Combo box (composite LE ordinal).

Definition at line 34 of file DlgPlate.h.

Typedef Documentation

◆ PDLGTEMPLATEEX

Definition at line 115 of file DlgPlate.h.

◆ PDLGITEMTEMPLATEEX

Definition at line 141 of file DlgPlate.h.

Function Documentation

◆ AllocDlgTemplate()

LPDLGTEMPLATE AllocDlgTemplate ( WORD  Size)

Allocate a classic dialog memory template.

The buffer is guaranteed to have the required DWORD alignment.

Definition at line 38 of file DlgPlate.cpp.

◆ FreeDlgTemplate()

void FreeDlgTemplate ( LPDLGTEMPLATE  pDlg)

Delete a classic dialog memory template.

Definition at line 44 of file DlgPlate.cpp.

◆ SetDlgStyle()

LPDLGITEMTEMPLATE SetDlgStyle ( LPDLGTEMPLATE  pBuf,
DWORD  Style,
short  X,
short  Y,
short  W,
short  H,
LPCWSTR  Caption,
WORD  nCtls,
LPCWSTR  Font,
WORD  Points 
)

Setup the dialog style..

SetDlgStyle returns a pointer to where to put the first dialog item.
See [MSDN] DLGTEMPLATE structure for further details..

Parameters
pBufDWORD aligned template buffer.
StyleDialog/window style flags.
YX,Y = Position (dialog units).
HW,H = Size (dialog units).
CaptionWindow caption.
nCtlsNr of DLGITEMTEMPLATES to follow.
FontTypeface name (Option.. if DS_SETFONT).
PointsPoint size of font (Option.. if DS_SETFONT or DS_SHELLFONT).

Definition at line 57 of file DlgPlate.cpp.

◆ AddDlgItem()

LPDLGITEMTEMPLATE AddDlgItem ( LPDLGITEMTEMPLATE  pBuf,
DWORD  Type,
DWORD  Style,
DWORD  ExStyle,
short  X,
short  Y,
short  W,
short  H,
LPCWSTR  Caption,
WORD  Id 
)

Add a dialog control item..

AddDlgItem returns a pointer to where to put the next dialog item.
See [MSDN] DLGITEMTEMPLATE structure for further details..

Parameters
pBufBuffer pointer (automatically DW aligned)
TypeOrdinal of predifined control class (ORD_nnn)
StyleControl style flags
ExStyleExtended style flags
YX,Y = Position (dialog units)
HW,H = Size (dialog units)
CaptionInitial text
IdControl ID

Definition at line 94 of file DlgPlate.cpp.

◆ AllocExDlgTemplate()

PDLGTEMPLATEEX AllocExDlgTemplate ( WORD  Size)

Allocate/Free extended dialog templates.

The buffers are guaranteed to have the required DWORD alignment.

Definition at line 128 of file DlgPlate.cpp.

◆ FreeExDlgTemplate()

void FreeExDlgTemplate ( PDLGTEMPLATEEX  pDlg)

Delete an extended dialog memory template.

Definition at line 133 of file DlgPlate.cpp.

◆ SetExDlgStyle()

PDLGITEMTEMPLATEEX SetExDlgStyle ( PDLGTEMPLATEEX  pBuf,
DWORD  Style,
short  X,
short  Y,
short  W,
short  H,
LPCWSTR  Caption,
DWORD  HelpId,
WORD  nCtls,
LPCWSTR  Font,
short  Points,
short  Weight = FW_NORMAL,
BYTE  CharSet = DEFAULT_CHARSET 
)

Setup the extended dialog style..

SetExDlgStyle returns a pointer to where to put the first dialog item.
See [MSDN] DLGTEMPLATEEX Structure for further details.

Parameters
pBufDWord aligned buffer
StyleDialog/window style flags
YX,Y = Position (dialog units)
HW,H = Size (dialog units)
CaptionWindow title
HelpIdHelp ID
nCtlsNr of DLGITEMTEMPLATEEX to follow
FontTypeface name (if DS_SETFONT or DS_SHELLFONT)
PointsFont size
WeightFont weight
CharSetCharacter set

Definition at line 146 of file DlgPlate.cpp.

◆ AddExDlgItem()

PDLGITEMTEMPLATEEX AddExDlgItem ( PDLGITEMTEMPLATEEX  pBuf,
DWORD  Type,
DWORD  Style,
DWORD  ExStyle,
short  X,
short  Y,
short  W,
short  H,
LPCWSTR  Caption,
WORD  Id,
DWORD  HelpId 
)

Add an extended dialog control item..

AddExDlgItem returns a pointer to where to put the next dialog item.
See [MSDN] DLGITEMTEMPLATEEX Structure for further details.

Parameters
pBufBuffer pointer (automatically DW aligned)
TypeOrdinal of predifined control class (ORD_nnn)
StyleControl style flags
ExStyleExtended style flags
YX,Y = Position (dialog units)
HW,H = Size (dialog units)
CaptionInitial text
IdControl ID
HelpIdHelp ID

Definition at line 206 of file DlgPlate.cpp.