mCtrl  0.9.6
dialog.h File Reference

Go to the source code of this file.

Detailed Description

Dialog functions.

This module offers functions for creation of modal and modeless dialogs in ery similar manner as standard functions DialogBox and CreateDialog do.

Therefore mCtrl functions are very similar to their USER32.DLL counterparts, including their function name and parameters. Actually the only difference is that the mCtrl functions take an extra argument dwFlags. When the dwFlags is zero, the functions behave exactly as the original functions.

When set to non-zero, the functions provide new functionality. Currently only the flag MC_DF_DEFAULTFONT is supported. When set, it forces the dialog to use default font, as defined by MS user interface guide lines.

All the functions support the classic dialog templates (DLGTEMPLATE) as well as the extended dialog templates (DLGTEMPLATEEX).

Dialog flags

#define MC_DF_DEFAULTFONT   0x00000001
 Force a default font into the dialog template. More...
 

Modeless dialog functions

#define mcCreateDialogW(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwFlags)
 
#define mcCreateDialogA(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwFlags)
 
#define mcCreateDialogIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwFlags)
 
#define mcCreateDialogIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwFlags)
 
HWND mcCreateDialogParamW (HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 
HWND mcCreateDialogParamA (HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 
HWND mcCreateDialogIndirectParamW (HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 
HWND mcCreateDialogIndirectParamA (HINSTANCE hInstance, LPCDLGTEMPLATEA lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 

Modal dialog functions

#define mcDialogBoxW(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwFlags)
 
#define mcDialogBoxA(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwFlags)
 
#define mcDialogBoxIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwFlags)
 
#define mcDialogBoxIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwFlags)
 
INT_PTR mcDialogBoxParamW (HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 
INT_PTR mcDialogBoxParamA (HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 
INT_PTR mcDialogBoxIndirectParamW (HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 
INT_PTR mcDialogBoxIndirectParamA (HINSTANCE hInstance, LPCDLGTEMPLATEA lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD dwFlags)
 

Unicode Resolution

#define mcCreateDialogParam   MCTRL_NAME_AW(mcCreateDialogParam)
 
#define mcCreateDialog   MCTRL_NAME_AW(mcCreateDialog)
 
#define mcCreateDialogIndirectParam   MCTRL_NAME_AW(mcCreateDialogIndirectParam)
 
#define mcCreateDialogIndirect   MCTRL_NAME_AW(mcCreateDialogIndirect)
 
#define mcDialogBoxParam   MCTRL_NAME_AW(mcDialogBoxParam)
 
#define mcDialogBox   MCTRL_NAME_AW(mcDialogBox)
 
#define mcDialogBoxIndirectParam   MCTRL_NAME_AW(mcDialogBoxIndirectParam)
 
#define mcDialogBoxIndirect   MCTRL_NAME_AW(mcDialogBoxIndirect)
 

Macro Definition Documentation

#define MC_DF_DEFAULTFONT   0x00000001

Force a default font into the dialog template.

When this flag is set, the dialog template is modified so the dialog uses a default font for the particular Windows version, according to the MS user interface guide lines.

Depending on Windows version, it forces the template to use MS Shell Dlg, MS Shell Dlg 2 or Segoe UI.

Note that when using this flag, the font specified originally in the dialog template is used only as a fallback in case of any error.

Attention
Metrics of the default fonts does differ. When using this font you should test your dialog on multiple Windows version to ensure that no content overflows.
#define mcCreateDialogW (   hInstance,
  lpTemplateName,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcCreateDialogParamW((hInstance),(lpTemplateName),(hWndParent), \
(lpDialogFunc),0L,(dwFlags))

Creates modeless dialog (Unicode variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
#define mcCreateDialogA (   hInstance,
  lpTemplateName,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcCreateDialogParamA((hInstance),(lpTemplateName),(hWndParent), \
(lpDialogFunc),0L,(dwFlags))

Creates modeless dialog (ANSI variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
#define mcCreateDialogIndirectW (   hInstance,
  lpTemplate,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcCreateDialogIndirectParamW((hInstance),(lpTemplate),(hWndParent), \
(lpDialogFunc),0L,(dwFlags))

Creates modeless dialog (Unicode variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
#define mcCreateDialogIndirectA (   hInstance,
  lpTemplate,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcCreateDialogIndirectParamA((hInstance),(lpTemplate),(hWndParent), \
(lpDialogFunc),0L,(dwFlags))

Creates modeless dialog (ANSI variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
#define mcDialogBoxW (   hInstance,
  lpTemplateName,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcDialogBoxParamW((hInstance),(lpTemplateName),(hWndParent), \
(lpDialogFunc),0L,(dwFlags))

Creates and runs modal dialog (Unicode variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
#define mcDialogBoxA (   hInstance,
  lpTemplateName,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcDialogBoxParamA((hInstance),(lpTemplateName),(hWndParent), \
(lpDialogFunc),0L,(dwFlags))

Creates and runs modal dialog (ANSI variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
#define mcDialogBoxIndirectW (   hInstance,
  lpTemplate,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcDialogBoxIndirectParamW((hInstance),(lpTemplate),(hWndParent), \
(lpDialogFunc),0L,(lpDialogFunc))

Creates and runs modal dialog (Unicode variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
#define mcDialogBoxIndirectA (   hInstance,
  lpTemplate,
  hWndParent,
  lpDialogFunc,
  dwFlags 
)
Value:
mcDialogBoxIndirectParamA((hInstance),(lpTemplate),(hWndParent), \
(lpDialogFunc),0L,(lpDialogFunc))

Creates and runs modal dialog (ANSI variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
#define mcCreateDialogParam   MCTRL_NAME_AW(mcCreateDialogParam)

Unicode-resolution alias.

See Also
mcCreateDialogParamW mcCreateDialogParamA
#define mcCreateDialog   MCTRL_NAME_AW(mcCreateDialog)

Unicode-resolution alias.

See Also
mcCreateDialogW mcCreateDialogA
#define mcCreateDialogIndirectParam   MCTRL_NAME_AW(mcCreateDialogIndirectParam)
#define mcCreateDialogIndirect   MCTRL_NAME_AW(mcCreateDialogIndirect)

Unicode-resolution alias.

See Also
mcCreateDialogIndirectW mcCreateDialogIndirectA
#define mcDialogBoxParam   MCTRL_NAME_AW(mcDialogBoxParam)

Unicode-resolution alias.

See Also
mcDialogBoxParamW mcDialogBoxParamA
#define mcDialogBox   MCTRL_NAME_AW(mcDialogBox)

Unicode-resolution alias.

See Also
mcDialogBoxW mcDialogBoxA
#define mcDialogBoxIndirectParam   MCTRL_NAME_AW(mcDialogBoxIndirectParam)

Unicode-resolution alias.

See Also
mcDialogBoxIndirectParamW mcDialogBoxIndirectParamA
#define mcDialogBoxIndirect   MCTRL_NAME_AW(mcDialogBoxIndirect)

Unicode-resolution alias.

See Also
mcDialogBoxIndirectW mcDialogBoxIndirectA

Function Documentation

HWND mcCreateDialogParamW ( HINSTANCE  hInstance,
LPCWSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates modeless dialog (Unicode variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
HWND mcCreateDialogParamA ( HINSTANCE  hInstance,
LPCSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates modeless dialog (ANSI variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
HWND mcCreateDialogIndirectParamW ( HINSTANCE  hInstance,
LPCDLGTEMPLATEW  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates modeless dialog (Unicode variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
HWND mcCreateDialogIndirectParamA ( HINSTANCE  hInstance,
LPCDLGTEMPLATEA  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates modeless dialog (ANSI variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
Handle of the created dialog or NULL on error.
INT_PTR mcDialogBoxParamW ( HINSTANCE  hInstance,
LPCWSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates and runs modal dialog (Unicode variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
INT_PTR mcDialogBoxParamA ( HINSTANCE  hInstance,
LPCSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates and runs modal dialog (ANSI variant).

Parameters
hInstance
lpTemplateName
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
INT_PTR mcDialogBoxIndirectParamW ( HINSTANCE  hInstance,
LPCDLGTEMPLATEW  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates and runs modal dialog (Unicode variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.
INT_PTR mcDialogBoxIndirectParamA ( HINSTANCE  hInstance,
LPCDLGTEMPLATEA  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  dwFlags 
)

Creates and runs modal dialog (ANSI variant).

Parameters
hInstance
lpTemplate
hWndParent
lpDialogFunc
lParamInit
dwFlagsDialog flags.
Returns
The result of the dialog run as stored with EndDialog, or -1 if the function fails.