USHORT cColumns = 4; // # of columns PFIELDINFO pFieldInfoHead; // --> First field PFIELDINFO pFieldInfo; // --> Current field FIELDINFOINSERT FieldInsertInfo; pFieldInfoHead = (PFIELDINFO) PVOIDFROMMR ( WinSendMsg (hwndContainer, CM_ALLOCDETAILFIELDINFO, MPFROMSHORT (cColumns), 0)); pFieldInfo = pFieldInfoHead; // Start at top of list //---------------------------------------------------------- // Load the field info structures for all columns //---------------------------------------------------------- for (i = 0; i < cColumns; i++) { pFieldInfo->cb = sizeof (FIELDINFO); pFieldInfo->flData = // Field attributes pFieldInfo->flTitle = // Title attributes pFieldInfo->pTitleData = // Column title pFieldInfo->offStruct = // Offset of data pFieldInfo->pUserData = NULL; pFieldInfo->cxWidth = 0; if this is the last column to the left of the split bar { SWP swp; WinQueryWindowPos (hwndContainer, &swp); cnrinfo.pFieldInfoLast = pFieldInfo; cnrinfo.xVertSplitbar = // split at 33% (swp.cx * 33) / 100; WinSendMsg (hwndContainer, CM_SETCNRINFO, MPFROMP (&cnrinfo), MPFROMLONG (CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); } pFieldInfo = pFieldInfo->pNextFieldInfo; }; //---------------------------------------------------------- // Construct the FIELDINFOINSERT structure that describes // the number of fields to be inserted, where they are to // be inserted, etc. //---------------------------------------------------------- memset (&FieldInsertInfo, 0, sizeof(FIELDINFOINSERT)); FieldInsertInfo.cb = sizeof (FIELDINFOINSERT); FieldInsertInfo.pFieldInfoOrder = (PFIELDINFO) CMA_END; FieldInsertInfo.cFieldInfoInsert = cColumns; FieldInsertInfo.fInvalidateFieldInfo = TRUE; //---------------------------------------------------------- // Insert the fields //---------------------------------------------------------- WinSendMsg (hwndContainer, CM_INSERTDETAILFIELDINFO, MPFROMP (pFieldInfoHead), MPFROMP (&FieldInsertInfo));