Jump to content

WinRegisterUserDatatype: Difference between revisions

From EDM2
Created page with "''This function registers a data type and defines its structure.'' ==Syntax== WinRegisterUserDatatype(hab, datatype, count, types) ==Parameters== ;hab (HAB) - Input : Anchor-block handle. ;datatype (LONG) - Input : Data type code to be defined. : This must not be less than DTYP_USER, and must not have been defined previously. ;count (LONG) - Input : Number of elements. : Must not be less than one. ;types (PLONG) - Input : Data type codes of structure c..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 5: Line 5:


==Parameters==
==Parameters==
;hab ([[HAB]]) - Input
;hab ([[HAB]]) - Input: Anchor-block handle.
: Anchor-block handle.
;datatype ([[LONG]]) - Input: Data type code to be defined.
;datatype ([[LONG]]) - Input
:This must not be less than DTYP_USER, and must not have been defined previously.
: Data type code to be defined.
;count (LONG) - Input: Number of elements.
: This must not be less than DTYP_USER, and must not have been defined previously.
;count ([[LONG]]) - Input
: Number of elements.
: Must not be less than one.
: Must not be less than one.
;types ([[PLONG]]) - Input
;types ([[PLONG]]) - Input: Data type codes of structure components.
: Data type codes of structure components.
: 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 on this function.
: 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 on this function.
: A control data type is followed by one or more entries in the ''types'' array that are interpreted in a special way. Control data types allow arrays, offsets, and lengths to be defined.
: A control data type is followed by one or more entries in the ''types'' array that are interpreted in a special way. Control data types allow arrays, offsets, and lengths to be defined.
: '''Simple Data Types:'''
: '''Simple Data Types:'''
:;DTYP_ATOM
::DTYP_ATOM - See [[ATOM]].
:: See [[ATOM]].
::DTYP_BIT16 - See [[USHORT]].
:;DTYP_BIT16
::DTYP_BIT32 - See [[ULONG]].
:: See [[USHORT]].
::DTYP_BIT8 - See [[UCHAR]].
:;DTYP_BIT32
::DTYP_BOOL - See [[BOOL]].
:: See [[ULONG]].
::DTYP_COUNT2 - See [[USHORT]].
:;DTYP_BIT8
::DTYP_COUNT2B - See [[USHORT]].
:: See [[UCHAR]].
::DTYP_COUNT2CH - See [[USHORT]].
:;DTYP_BOOL
::DTYP_COUNT4B - See [[ULONG]].
:: See [[BOOL]].
::DTYP_CPID - See [[USHORT]].
:;DTYP_COUNT2
::DTYP_ERRORID - See [[ERRORID]].
:: See [[USHORT]].
::DTYP_IDENTITY - See [[USHORT]].
:;DTYP_COUNT2B
::DTYP_IDENTITY4 - See [[ULONG]].
:: See [[USHORT]].
::DTYP_INDEX2 - See [[USHORT]].
:;DTYP_COUNT2CH
::DTYP_IPT - See [[IPT]].
:: See [[USHORT]].
::DTYP_LENGTH2 - See [[USHORT]].
:;DTYP_COUNT4B
::DTYP_LENGTH4 - See [[ULONG]].
:: See [[ULONG]].
::DTYP_LONG - See [[LONG]].
:;DTYP_CPID
::DTYP_OFFSET2B - See [[USHORT]].
:: See [[USHORT]].
::DTYP_PID - See [[PID]].
:;DTYP_ERRORID
::DTYP_PIX - See [[PIX]].
:: See [[ERRORID]].
::DTYP_PROGCATEGORY - See [[PROGCATEGORY]].
:;DTYP_IDENTITY
::DTYP_PROPERTY2 - See [[USHORT]].
:: See [[USHORT]].
::DTYP_PROPERTY4 - See [[LONG]].
:;DTYP_IDENTITY4
::DTYP_RESID - See [[HMODULE]].
:: See [[ULONG]].
::DTYP_SEGOFF - See [[SEGOFF]].
:;DTYP_INDEX2
::DTYP_SHORT - See [[SHORT]].
:: See [[USHORT]].
::DTYP_TID - See [[TID]].
:;DTYP_IPT
::DTYP_TIME - See [[LONG]].
:: See [[IPT]].
::DTYP_UCHAR - See [[UCHAR]].
:;DTYP_LENGTH2
::DTYP_ULONG - See [[ULONG]].
:: See [[USHORT]].
::DTYP_USHORT - See [[USHORT]].
:;DTYP_LENGTH4
::DTYP_WIDTH4 - See [[LONG]].
:: See [[ULONG]].
::DTYP_WNDPROC - See [[PFNWP]].
:;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:'''
: '''Handle Data Types:'''
:;DTYP_HAB
::DTYP_HAB - See [[HAB]].
:: See [[HAB]].
::DTYP_HACCEL - See [[HACCEL]].
:;DTYP_HACCEL
::DTYP_HAPP - See [[HAPP]].
:: See [[HACCEL]].
::DTYP_HATOMTBL - See [[HATOMTBL]].
:;DTYP_HAPP
::DTYP_HBITMAP - See [[HBITMAP]].
:: See [[HAPP]].
::DTYP_HDC - See [[HDC]].
:;DTYP_HATOMTBL
::DTYP_HENUM - See [[HENUM]].
:: See [[HATOMTBL]].
::DTYP_HINI - See [[HINI]].
:;DTYP_HBITMAP
::DTYP_HLIB - See [[HLIB]].
:: See [[HBITMAP]].
::DTYP_HMF - See [[HMF]].
:;DTYP_HDC
::DTYP_HMQ - See [[HMQ]].
:: See [[HDC]].
::DTYP_HPOINTER - See [[HPOINTER]].
:;DTYP_HENUM
::DTYP_HPROGRAM - See [[HPROGRAM]].
:: See [[HENUM]].
::DTYP_HPS - See [[HPS]].
:;DTYP_HINI
::DTYP_HRGN - See [[HRGN]].
:: See [[HINI]].
::DTYP_HSEM - See [[HSEM]].
:;DTYP_HLIB
::DTYP_HSPL - See [[HSPL]].
:: See [[HLIB]].
::DTYP_HSWITCH - See [[HSWITCH]].
:;DTYP_HMF
::DTYP_HWND - See [[HWND]].
:: 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:'''
: '''Character/String/Buffer Data Types:'''
:;DTYP_BYTE
::DTYP_BYTE - See [[BYTE]].
:: See [[BYTE]].
::DTYP_CHAR - See [[CHAR]].
:;DTYP_CHAR
::DTYP_STRL - See [[PSZ]].
:: See [[CHAR]].
::DTYP_STR16 - See [[STR16]].
:;DTYP_STRL
::DTYP_STR32 - See [[STR32]].
:: See [[PSZ]].
::DTYP_STR64 - See [[STR64]].
:;DTYP_STR16
::DTYP_STR8 - See [[STR8]].
:: See [[STR16]].
:;DTYP_STR32
:: See [[STR32]].
:;DTYP_STR64
:: See [[STR64]].
:;DTYP_STR8
:: See [[STR8]].
: '''Structure Data Types:'''
: '''Structure Data Types:'''
:;DTYP_ACCEL
::DTYP_ACCEL - See [[ACCEL]].
:: See [[ACCEL]].
::DTYP_ACCELTABLE - See [[ACCELTABLE]].
:;DTYP_ACCELTABLE
::DTYP_ARCPARAMS - See [[ARCPARAMS]].
:: See [[ACCELTABLE]].
::DTYP_AREABUNDLE - See [[AREABUNDLE]].
:;DTYP_ARCPARAMS
::DTYP_BITMAPINFO - See [[BITMAPINFO]].
:: See [[ARCPARAMS]].
::DTYP_BITMAPINFOHEADER - See [[BITMAPINFOHEADER]].
:;DTYP_AREABUNDLE
::DTYP_BTNCDATA - See [[BTNCDATA]].
:: See [[AREABUNDLE]].
::DTYP_CATCHBUF - See [[CATCHBUF]].
:;DTYP_BITMAPINFO
::DTYP_CHARBUNDLE - See [[CHARBUNDLE]].
:: See [[BITMAPINFO]].
::DTYP_CLASSINFO - See [[CLASSINFO]].
:;DTYP_BITMAPINFOHEADER
::DTYP_CREATESTRUCT - See [[CREATESTRUCT]].
:: See [[BITMAPINFOHEADER]].
::DTYP_CURSORINFO - See [[CURSORINFO]].
:;DTYP_BTNCDATA
::DTYP_DEVOPENSTRUC - See [[DEVOPENSTRUC]].
:: See [[BTNCDATA]].
::DTYP_DLGTEMPLATE - See [[DLGTEMPLATE]].
:;DTYP_CATCHBUF
::DTYP_DLGTITEM - See [[DLGTITEM]].
:: See [[CATCHBUF]].
::DTYP_ENTRYFDATA - See [[ENTRYFDATA]].
:;DTYP_CHARBUNDLE
::DTYP_FATTRS - See [[FATTRS]].
:: See [[CHARBUNDLE]].
::DTYP_FFDESCS - See [[FFDESCS]].
:;DTYP_CLASSINFO
::DTYP_FIXED - See [[FIXED]].
:: See [[CLASSINFO]].
::DTYP_FONTMETRICS - See [[FONTMETRICS]].
:;DTYP_CREATESTRUCT
::DTYP_FRAMECDATA - See [[FRAMECDATA]].
:: See [[CREATESTRUCT]].
::DTYP_GRADIENTL - See [[GRADIENTL]].
:;DTYP_CURSORINFO
::DTYP_HCINFO - See [[HCINFO]].
:: See [[CURSORINFO]].
::DTYP_IMAGEBUNDLE - See [[IMAGEBUNDLE]].
:;DTYP_DEVOPENSTRUC
::DTYP_KERNINGPAIRS - See KERNINGPAIRS.
:: See [[DEVOPENSTRUC]].
::DTYP_LINEBUNDLE - See [[LINEBUNDLE]].
:;DTYP_DLGTEMPLATE
::DTYP_MARGSTRUCT - See [[MLEMARGSTRUCT]].
:: See [[DLGTEMPLATE]].
::DTYP_MARKERBUNDLE - See [[MARKERBUNDLE]].
:;DTYP_DLGTITEM
::DTYP_MATRIXLF - See [[MATRIXLF]].
:: See [[DLGTITEM]].
::DTYP_MLECTLDATA - See [[MLECTLDATA]].
:;DTYP_ENTRYFDATA
::DTYP_OVERFLOW - See [[MLEOVERFLOW]].
:: See [[ENTRYFDATA]].
::DTYP_OWNERITEM - See [[OWNERITEM]].
:;DTYP_FATTRS
::DTYP_POINTERINFO - See [[POINTERINFO]].
:: See [[FATTRS]].
::DTYP_POINTL - See [[POINTL]].
:;DTYP_FFDESCS
::DTYP_PROGRAMENTRY - See [[PROGRAMENTRY]].
:: See [[FFDESCS]].
::DTYP_PROGTYPE - See [[PROGTYPE]].
:;DTYP_FIXED
::DTYP_QMSG - See [[QMSG]].
:: See [[FIXED]].
::DTYP_RECTL - See [[RECTL]].
:;DTYP_FONTMETRICS
::DTYP_RGB - See [[RGB]].
:: See [[FONTMETRICS]].
::DTYP_RGNRECT - See [[RGNRECT]].
:;DTYP_FRAMECDATA
::DTYP_SBCDATA - See [[SBCDATA]].
:: See [[FRAMECDATA]].
::DTYP_SIZEF - See [[SIZEF]].
:;DTYP_GRADIENTL
::DTYP_SIZEL - See [[SIZEL]].
:: See [[GRADIENTL]].
::DTYP_SWBLOCK - See [[SWBLOCK]].
:;DTYP_HCINFO
::DTYP_SWCNTRL - See [[SWCNTRL]].
:: See [[HCINFO]].
::DTYP_SWENTRY - See [[SWENTRY]].
:;DTYP_IMAGEBUNDLE
::DTYP_SWP - See [[SWP]].
:: See [[IMAGEBUNDLE]].
::DTYP_TRACKINFO - See [[TRACKINFO]].
:;DTYP_KERNINGPAIRS
::DTYP_USERBUTTON - See [[USERBUTTON]].
:: See KERNINGPAIRS.
::DTYP_WNDPARAMS - See [[WNDPARAMS]].
:;DTYP_LINEBUNDLE
::DTYP_WPOINT - See [[WPOINT]].
:: See [[LINEBUNDLE]].
::DTYP_WRECT - See [[WRECT]].
:;DTYP_MARGSTRUCT
::DTYP_XYWINSIZE - See [[XYWINSIZE]].
:: 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:'''
: '''Pointer Data Type:'''
:;DTYP_P*
:;DTYP_P*
Line 282: Line 165:


==Returns==
==Returns==
;rc ([[BOOL]]) - returns
;rc ([[BOOL]]) - returns: Success indicator.
: Success indicator.
::TRUE - Successful completion.
:;TRUE
::FALSE - Error occurred.
:: Successful completion.
:;FALSE
:: Error occurred.


==Remarks==
==Remarks==

Latest revision as of 11:23, 18 April 2025

This function registers a data type and defines its structure.

Syntax

WinRegisterUserDatatype(hab, datatype, count, types)

Parameters

hab (HAB) - Input
Anchor-block handle.
datatype (LONG) - Input
Data type code to be defined.
This must not be less than DTYP_USER, and must not have been defined previously.
count (LONG) - Input
Number of elements.
Must not be less than one.
types (PLONG) - Input
Data type codes of structure components.
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 on this function.
A control data type is followed by one or more entries in the types 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.
The following describes the possible 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), or the index of the element in types corresponding to the structure component which contains the number of elements in the array being defined. This component must have a suitable numeric data type. The array-size element must recede element 'n' in types. 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.
The following describes the possible elements:
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 in types corresponding to the first structure component that is included in the length; 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 in types corresponding to the last structure component that is included in the length; 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.
The following describes the possible elements:
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), or the index of the element in types corresponding to the structure component that contains the number of elements in the array being defined; 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.
The following describes the possible 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) or the index of the element in types corresponding to the structure component that contains the number of elements in the array being defined. 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.

Returns

rc (BOOL) - returns
Success indicator.
TRUE - Successful completion.
FALSE - Error occurred.

Remarks

This function has no effect unless the RegisterUserHook hook has been set.

The value to be used should be obtained by calling WinAddAtom with the handle of the system atom manager, and subtracting DTYP_ATOM_OFFSET from the result.

WinAddAtom is guaranteed to return values in the range 0xC000 to 0xFFFF.

When a data type is defined using this function, a definition for the corresponding pointer data type is automatically established.

Errors

Possible returns from WinGetLastError:

  • PMERR_DATATYPE_TOO_SMALL (0x1048) - The datatype specified was too small.
  • PMERR_DATATYPE_NOT_UNIQUE (0x1046) - An attempt to register a datatype failed because it is not unique.
  • PMERR_ARRAY_TOO_SMALL (0x103E) - The array specified was too small.
  • PMERR_DATATYPE_ENTRY_NOT_NUM (0x1043) - The datatype entry specified was not numerical.
  • PMERR_DATATYPE_ENTRY_NOT_OFF (0x1044) - The datatype entry specified was not an offset.
  • PMERR_DATATYPE_ENTRY_BAD_INDEX (0x103F) - An invalid datatype entry index was specified.
  • PMERR_DATATYPE_ENTRY_CTL_MISS (0x1041) - The datatype entry control was missing.
  • PMERR_DATATYPE_ENTRY_CTL_BAD (0x1040) - An invalid datatype entry control was specified.

Example Code

This example calls WinRegisterUserDatatype to register a class or returns FALSE if an error occurs.

#define INCL_WINMESSAGEMGR
#define INCL_WINTYPES
#include <OS2.H>
#define DTYP_MINE DTYP_USER + 1

HAB hab;
LONG  asTypes[3] = {DTYP_CHAR,
                    DTYP_STRL,
                    DTYP_STR32};

WinRegisterUserDataType(hab,
                        DTYP_MINE,
                        3,
                        asTypes);

Related Functions