<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_FieldCount |
Declare Function sx_FieldCount Lib "Apollo9.dll" () As Integer
USHORT FAR PASCAL sx_FieldCount (VOID);
Extracts the number of fields in the current table. This number does not include the hidden delete flag field.
An integer containing the number of fields in each record.
Sub Form_Load ()
Static FieldTabs(3) As Integer
Dim i As Integer
' Fill list box List1 with field info
FieldTabs(1) = 48
FieldTabs(2) = 65
FieldTabs(3) = 84
k& = SendDlgItemMessage(sxdbinfo.hWnd, GetDlgCtrlID(List1.hWnd),
Ä (LB_SETTABSTOPS, 3, FieldTabs(1))
For i = 1 To sx_FieldCount()
ListName$ = sx_FieldName(i)
ListStr$ = ListName$ + Chr(9) + sx_FieldType(ListName$) +
Ä (Chr(9) + Format$(sx_FieldWidth(ListName$), "000") +
Ä (Chr(9) + Format$(sx_FieldDecimals(ListName$),"00")
List1.AddItem ListStr$, (i - 1)
Next i
End Sub
// fill list box with field data
uiFieldCount = sx_FieldCount();
// set list box items
for (i = 0; i < (SHORT) uiFieldCount; i++)
{
lstrcpy((LPSTR) caFieldName, (LPSTR) sx_FieldName(i + 1));
lstrcpy((LPSTR) caFieldType, (LPSTR) sx_FieldType(caFieldName));
itoa(sx_FieldWidth(caFieldName), caFieldLen, 10);
itoa(sx_FieldDecimals(caFieldName), caFieldDec, 10);
// non-memos only
if (caFieldType[0] != 'M')
{
_fmemset(caString, 0, (size_t) sizeof(caString));
lstrcpy(caString, caFieldName);
caString[lstrlen(caString)] = '\t';
lstrcat(caString, caFieldType);
caString[lstrlen(caString)] = '\t';
lstrcat(caString, caFieldLen);
caString[lstrlen(caString)] = '\t';
lstrcat(caString, caFieldDec);
SendDlgItemMessage(hdlg, ID_L1,
LB_ADDSTRING, NULL, (LPSTR) caString);
}
}
sx_FieldDecimals, sx_FieldName, sx_FieldNum, sx_FieldOffset, sx_FieldType, sx_FieldWidth