RegisterUserHook
Appearance
This hook is called whenever a user message or data type is registered.
Syntax
RegisterUserHook(hab, cUshort, arRMP, fRegistered);
Parameters
- hab (HAB) - input
- The application anchor block.
- cUshort (ULONG) - input
- Number of data type codes.
- For data types, this parameter is the number of data type codes in arRMP, This value must not be less than one.
- For messages, this parameter is set to 0.
- arRMP (PUSHORT) - input
- Array of data type codes.
- For data types, this parameter is an array of data type codes. For messages, this parameter is set to NULL.
- Valid data types are the system-defined data types and their pointer equivalents, application-defined data types and their pointer equivalents, and control data types. Note that not all of the data types that occur in the CPI can be specified in this function.
- A control data type is followed by one or more entries in the arRMP array that are interpreted in a special way. Control data types allow arrays, offsets, and lengths to be defined.
- Simple Data Types:
- DTYP_ATOM See ATOM.
- DTYP_BIT16 See USHORT.
- DTYP_BIT32 See ULONG.
- DTYP_BIT8 See UCHAR.
- DTYP_BOOL See BOOL.
- DTYP_COUNT2 See USHORT.
- DTYP_COUNT2B See USHORT.
- DTYP_COUNT2CH See USHORT.
- DTYP_COUNT4B See ULONG.
- DTYP_CPID See USHORT.
- DTYP_ERRORID See ERRORID.
- DTYP_IDENTITY See USHORT.
- DTYP_IDENTITY4 See ULONG.
- DTYP_INDEX2 See USHORT.
- DTYP_IPT See IPT.
- DTYP_LENGTH2 See USHORT.
- DTYP_LENGTH4 See ULONG.
- DTYP_LONG See LONG.
- DTYP_OFFSET2B See USHORT.
- DTYP_PID See PID.
- DTYP_PIX See PIX.
- DTYP_PROGCATEGORY See PROGCATEGORY.
- DTYP_PROPERTY2 See USHORT.
- DTYP_PROPERTY4 See LONG.
- DTYP_RESID See HMODULE.
- DTYP_SEGOFF See SEGOFF.
- DTYP_SHORT See SHORT.
- DTYP_TID See TID.
- DTYP_TIME See LONG.
- DTYP_UCHAR See UCHAR.
- DTYP_ULONG See ULONG.
- DTYP_USHORT See USHORT.
- DTYP_WIDTH4 See LONG.
- DTYP_WNDPROC See PFNWP.
- Handle Data Types:
- DTYP_HAB See HAB.
- DTYP_HACCEL See HACCEL.
- DTYP_HAPP See HAPP.
- DTYP_HATOMTBL See HATOMTBL.
- DTYP_HBITMAP See HBITMAP.
- DTYP_HDC See HDC.
- DTYP_HENUM See HENUM.
- DTYP_HINI See HINI.
- DTYP_HLIB See HLIB.
- DTYP_HMF See HMF.
- DTYP_HMQ See HMQ.
- DTYP_HPOINTER See HPOINTER.
- DTYP_HPROGRAM See HPROGRAM.
- DTYP_HPS See HPS.
- DTYP_HRGN See HRGN.
- DTYP_HSEM See HSEM.
- DTYP_HSPL See HSPL.
- DTYP_HSWITCH See HSWITCH.
- DTYP_HWND See HWND.
- Character/String/Buffer Data Types:
- DTYP_BYTE See BYTE.
- DTYP_CHAR See CHAR.
- DTYP_STRL See PSZ.
- DTYP_STR16 See STR16.
- DTYP_STR32 See STR32.
- DTYP_STR64 See STR64.
- DTYP_STR8 See STR8.
- Structure Data Types:
- DTYP_ACCEL See ACCEL.
- DTYP_ACCELTABLE See ACCELTABLE.
- DTYP_ARCPARAMS See ARCPARAMS.
- DTYP_AREABUNDLE See AREABUNDLE.
- DTYP_BITMAPINFO See BITMAPINFO.
- DTYP_BITMAPINFOHEADER See BITMAPINFOHEADER.
- DTYP_BTNCDATA See BTNCDATA.
- DTYP_CATCHBUF See CATCHBUF.
- DTYP_CHARBUNDLE See CHARBUNDLE.
- DTYP_CLASSINFO See CLASSINFO.
- DTYP_CREATESTRUCT See CREATESTRUCT.
- DTYP_CURSORINFO See CURSORINFO.
- DTYP_DEVOPENSTRUC See DEVOPENSTRUC.
- DTYP_DLGTEMPLATE See DLGTEMPLATE.
- DTYP_DLGTITEM See DLGTITEM.
- DTYP_ENTRYFDATA See ENTRYFDATA.
- DTYP_FATTRS See FATTRS.
- DTYP_FFDESCS See FFDESCS.
- DTYP_FIXED See FIXED.
- DTYP_FONTMETRICS See FONTMETRICS.
- DTYP_FRAMECDATA See FRAMECDATA.
- DTYP_GRADIENTL See GRADIENTL.
- DTYP_HCINFO See HCINFO.
- DTYP_IMAGEBUNDLE See IMAGEBUNDLE.
- DTYP_KERNINGPAIRS See KERNINGPAIRS.
- DTYP_LINEBUNDLE See LINEBUNDLE.
- DTYP_MARGSTRUCT See MLEMARGSTRUCT.
- DTYP_MARKERBUNDLE See MARKERBUNDLE.
- DTYP_MATRIXLF See MATRIXLF.
- DTYP_MLECTLDATA See MLECTLDATA.
- DTYP_OVERFLOW See MLEOVERFLOW.
- DTYP_OWNERITEM See OWNERITEM.
- DTYP_POINTERINFO See POINTERINFO.
- DTYP_POINTL See POINTL.
- DTYP_PROGRAMENTRY See PROGRAMENTRY.
- DTYP_PROGTYPE See PROGTYPE.
- DTYP_QMSG See QMSG.
- DTYP_RECTL See RECTL.
- DTYP_RGB See RGB.
- DTYP_RGNRECT See RGNRECT.
- DTYP_SBCDATA See SBCDATA.
- DTYP_SIZEF See SIZEF.
- DTYP_SIZEL See SIZEL.
- DTYP_SWBLOCK See SWBLOCK.
- DTYP_SWCNTRL See SWCNTRL.
- DTYP_SWENTRY See SWENTRY.
- DTYP_SWP See SWP.
- DTYP_TRACKINFO See TRACKINFO.
- DTYP_USERBUTTON See USERBUTTON.
- DTYP_WNDPARAMS See WNDPARAMS.
- DTYP_WPOINT See WPOINT.
- DTYP_WRECT See WRECT.
- DTYP_XYWINSIZE See XYWINSIZE.
- Pointer Data Type:
- DTYP_P* Pointer to an item of data type DTYP_*, where DTYP_* is one of the data types in the preceding lists. The value of a pointer data type is the value of the corresponding non-pointer data type prefixed with a minus to make it negative.
- Minimum Application Data Type:
- DTYP_USER Minimum value for application-defined non-pointer data types.
- Control Data Type:
- DTYP_CTL_ARRAY This starts a sequence of three array elements that define an array; the array resides in the structure being defined, and may have a fixed number of elements or a variable number of elements.
- n DTYP_CTL_ARRAY
- n+1 Data type of array data.
- n+2 Minus the number of elements in the array (for an array of fixed size). This component must have a suitable numeric data type. The index is zero-based.
- DTYP_CTL_LENGTH This starts a sequence of four array elements that define a structure component containing the length of part or all of the structure. The length component resides at this point in the structure.
- n DYP_CTL_LENGTH
- n+1 Data type of structure component that contains the length (must be a suitable numeric data type).
- n+2 The index of the element. A value of -1 denotes the start of the structure. This index is zero-based. The element specified must not be one that is the second or subsequent element in a DTYP_CTL_* sequence of elements.
- N+3 The index of the element. It must not be less than the value contained in element n+2. A value of -1 denotes the end of the structure. The index is zero-based. The element specified must not be one that is the second or subsequent element in a DTYP_CTL_* sequence of elements. If the value is -1, the length includes all offset data residing at the end of the structure.
- DTYP_CTL_OFFSET This starts a sequence of four array elements that define data addressed by an offset. The offset resides at this point in the structure, and contains the offset in bytes of the data from the start of the outermost structure in which this component resides. The data addressed by the offset must occupy storage following the fixed part of the structure. The data may be scalar data or array data.
- n DTYP_CTL_OFFSET
- n+1 Data type of the structure component that contains the offset (must be a suitable unsigned numeric data type).
- n+2 Data type of offset data.
- n+3 Minus the number of elements in the array (for an array of fixed size). This component must have a suitable numeric data type; the array-size element may occur earlier or later in the structure. This index is zero-based. A value of -1 indicates that the data is not an array.
- DTYP_CTL_PARRAY This starts a sequence of three array elements that define a pointer to an array. The pointer resides at this point in the structure, and the array resides elsewhere. The array can have a fixed or variable number of elements.
- n DTYP_CTL_PARRAY
- n+1 Data type of array data.
- n+2 Minus the number of elements in the array (for an array of fixed size). This component must have a suitable numeric data type. The array-size element may occur earlier or later in the structure. The index is zero-based.
- fRegistered (PBOOL) - input
- Flag indicating that a message or data type was registered.
- TRUE: Message/data type was registered.
- FALSE: Message/data type was not registered.
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion
- FALSE: Errors occurred.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion
- FALSE: Errors occurred.
Remarks
This hook is called when a call is made to either WinRegisterUserDatatype or WinRegisterUserMsg.
Example Code
#define INCL_WINHOOKS /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HAB hab; /* The application anchor block. */ ULONG cUshort; /* Number of data type codes. */ PUSHORT arRMP; /* Array of data type codes. */ PBOOL fRegistered; /* Flag indicating that a message or data type was registered. */ BOOL rc; /* Success indicator. */ rc = RegisterUserHook(hab, cUshort, arRMP, fRegistered);