Describing a Parameter Block

A parameter block is created with a parameter block descriptor as an argument. There is exactly one parameter block descriptor for every parameter block. A programmer must create a singleton parameter block descriptor that remains valid throughout the life of the DLL. This can be done by declaring a static instance in the DLL. The ParamBlockDesc2 constructor takes a variable amount of arguments that describe the parameter block. Alternatively you can construct the parameter block descriptor incrementally using methods such ParamBlockDesc2::AddParam() and ParamBlockDesc2::ParamOption().

Of the arguments that need to be listed, the first five arguments are required. After that, some arguments are included only if you supplied some special flags in the 5th argument (flags). The parameter flags are documented in the topic Parameter Block Flags.

Afterwards, for each parameter for which you want a user interface control, you will supply mandatory and optional arguments. At the end of each parameter description section you will supply the special argument tag p_end. At the end of the entire constructor you must also supply the tag p_end.

Parameter Block Descriptor 2 Constructor

ParamBlockDesc2
(
   // Required specifications
   BlockID     ID,
   TCHAR*      int_name,
   int        local_name,
   ClassDesc2* cd,
   BYTE       flags,
    
   // ONLY IF P_VERSION is specified as a flag
   int	version_number,
 
   // ONLY IF P_AUTO_CONSTRUCT is specified as a flag
   // This is the same reference number that specifies the
   // parameter block used in GetReference() and SetReference().
   int	reference_number,
    
   // ONLY IF P_AUTO_UI is specified above
   // Automatic UI parameter map specifications
   int	dialog_template_ID,
   int	dialog_title_res_ID,
   int	flag_mask,
   int	rollup_flags,
    ParamMap2UserDlgProc* proc,
 
   // ONLY IF P_INCLUDE_PARAMS or P_USE_PARAMS is specified as a flag
   // Address of source IParamblockDesc to use
    ParamBlockDesc2* pSourceDesc,
  
     // OPTIONAL
     // FOR EACH variable control create a parameter specification:
     // There is one of these parameter specifications for each control.
     ParamID   id,
     TCHAR*    internal_name,
     ParamType type,
     // Optional. Use this argument ONLY IF you use a Tab<> type
     [int      table_size,
     int       flags,
     int      local_name_res_ID,
     
       // FOR EACH parameter specification, specify zero or more parameter tags.        
        // and optional parameter information
       Parameter_Tag
 
     p_end, //End for each parameter specification
   p_end //End for all the variable arguments
);

Below is a sample parameter block:

static  ParamBlockDesc2 widget_param_blk (
   //Required arguments ----------------------------
   widget_params, _T("params"), 0, &WidgetDesc,
   //flags
   P_AUTO_CONSTRUCT + P_AUTO_UI,
 
   //Dependent arguments ---------------------------
   //required because P_AUTO_CONSTRUCT was flagged
   //This declares the reference number of the Parameter Block.
   PBLOCK_REF,
   //required because P_AUTO_UI was flagged.
   //This is the Rollout description
   IDD_PANEL, IDS_PARAMS, 0, 0, NULL,
 
   //Parameter Specifications ----------------------
   // For each control create a parameter:
   widget_size,      _T("size"),      TYPE_FLOAT,    P_ANIMATABLE,    IDS_SPIN,
     //3 optional tags
     p_default,      1.0f,
     p_range,      0.0f,1000.0f,
     p_ui,        TYPE_SPINNER,     EDITTYPE_FLOAT, IDC_SIZE_EDIT,   IDC_SIZE_SPIN, 0.50f,
     p_end,
   widget_left,     _T("Left"),      TYPE_FLOAT,    P_ANIMATABLE,    IDS_SPIN,
     //3 optional tags  
     p_default,      0.0f,
     p_range,      0.0f,100.0f,
     p_ui,        TYPE_SPINNER,     EDITTYPE_UNIVERSE, IDC_LEFT_EDIT,   IDC_LEFT_SPIN, 0.50f,
     p_end,
   widget_right,     _T("Right"),      TYPE_FLOAT,    P_ANIMATABLE,    IDS_SPIN,
     //3 optional tags  
     p_default,      0.0f,
     p_range,      0.0f,100.0f,
     p_ui,        TYPE_SPINNER,     EDITTYPE_UNIVERSE, IDC_RIGHT_EDIT,   IDC_RIGHT_SPIN, 0.50f,
     p_end,
   p_end
);