CPBComponent::CPBComponent

Class CPBComponent

CPBComponent (PCTSTR pszName, PCTSTR pszMessageKey = "", BOOL blEnable = TRUE, ULONG ulExclude = PB_DEFAULT_EXCLUDE, INT iOption = PB_MODULE_DEFAULT)

CPBComponent (ULONG ulNameStringId, HINSTANCE hModule = NULL, PCTSTR pszMessageKey = "", BOOL blEnable = TRUE, ULONG ulExclude = PB_DEFAULT_EXCLUDE, INT iOption = PB_MODULE_DEFAULT)

CPBComponent (PB_COMPONENT* pcp, INT iOption = PB_MODULE_DEFAULT)

Parameters

ulNameStringId String table resource identifier of string that will be used for the szName field of the underlying PB_COMPONENT structure.

hModule Handle to module containing the string table into which ulNameStringId is an index.

iOption Flag governing whether component is to be set as the thread or module default or neither. May be one of the following:

PB_THREAD_DEFAULT The constructor calls PBSetDefaultComponent to set the component as the default for this thread.

PB_MODULE_DEFAULT The constructor calls PBSetDefaultComponent to set the component as the default for the entire module.

PB_NO_DEFAULT The constructor does not call PBSetDefaultComponent.

pcp Pointer to PB_COMPONENT structure to manage.

The remaining parameters simply map one for one to the elements of the underlying PB_COMPONENT structure.

Note that the ulExclude parameter defaults to PB_DEFAULT_EXCLUDE which changes value in builds where PB_DEBUG_LEVEL is set to 1.

Remarks

The first two constructors initialize an internal PB_COMPONENT structure by calling PBSetComponent while the third assumes an externally initialized structure and so does no initialization. All constructors then call PBSetDefaultComponent to set the component as the thread or module default as per the flags specified for the iOption parameter. If the component is set as the thread or module default by the constructor then the destructor will call PBSetDefaultComponent to undo this action; creating in effect a push/pop operation.

Passing NULL (the default value) for the hModule parameter results in an attempt to load the string from the calling process. If the string table resides in a DLL, the parameter must be non-NULL.