Passing a 16:16 Pointer as a Message Parameter

typedef struct mystruct {                  /* Define data structure      */
                        CHAR * _Seg16 Name;
                        ULONG         ulA;
                        ULONG         ulB;
                        USHORT        usC;
                        } MYSTRUCT;

pragma seg16(MYSTRUCT)                     /* Define pragma directive    */

MYSTRUCT * _Seg16 MyStruct;                /* 16:16 pointer              */

APIRET   rc;                               /* Return code                */

MPARAM   mp1;                              /* Message parameter          */

rc = DosAllocMem(&MyStruct,                /* Allocate data structure    */
                 4096,                     /* Size of data structure     */
                 PAG_READ  |               /* Allow read access          */
                 PAG_WRITE |               /* Allow write access         */
                 PAG_COMMIT);              /* Commit storage immediately */

<Initialize structure if required>

mp1 = MPFROMP(MyStruct);                   /* Set message parameter      */

This example shows the 32-bit code necessary to define and initialize a 16:16 pointer to be passed to a 16-bit window procedure.


[Back: Creating a 16-bit Window From Within a 32-bit Module]
[Next: Mixed Model Programming - WinSetWindowThunkProc() Function]