home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
vpcvrsam.zip
/
VPCVRSAM
/
Main
/
Form.1
< prev
next >
Wrap
Text File
|
1995-08-01
|
5KB
|
103 lines
/* Event Opened - Form REXXAWAR\Main */
CHAR aTextValue[255]="text";
LONG anIntegerValue=0;
ULONG anUnsignedValue=0;
PSZ filename="SAMPLE.DAT";
FILE *file;
/* View as details 1000 Container */
{
CNRINFO cnrinfo;
cnrinfo.cb=sizeof(CNRINFO);
cnrinfo.flWindowAttr=CV_DETAIL | CA_DETAILSVIEWTITLES | CA_MIXEDTARGETEMPH;
WinSendDlgItemMsg(hwndDlg, 1000,
CM_SETCNRINFO,
MPFROMP(&cnrinfo),
MPFROMLONG(CMA_FLWINDOWATTR));
}
file = fopen (filename, "r");
if (file != NULL)
{
int count;
fgets (aTextValue, sizeof (aTextValue), file);
count = atoi (aTextValue);
while (count--)
{
/* Add a container record to end 1000 Container */
{
PMAIN_1000_REC pRecord; /* Pointer to cnr item. */
/* IMPORTANT!!!! Manually replace MAIN with the form name */
/* This pRecord typedef is contained in the .H for this form */
RECORDINSERT RecordInsert;
/* IMPORTANT!!! we allocate 10*32 extra bytes for the pszIcon string */
/* We must allocate more than that if we have any extra PSZ members */
/* as columns */
pRecord=(PVOID)WinSendDlgItemMsg(hwndDlg, 1000,
CM_ALLOCRECORD,
MPFROMLONG(sizeof(*pRecord)-sizeof(MINIRECORDCORE)+10*32), /* Bytes of additional data */
MPFROMLONG(1)); /* Number of records */
pRecord->Record.cb=sizeof(MINIRECORDCORE);
pRecord->Record.flRecordAttr=0;
pRecord->Record.hptrIcon=WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE);
/* IMPORTANT!!! initiaize other members here if they exist */
fgets (aTextValue, sizeof (aTextValue), file); /* 1. */
pRecord->Record.pszIcon=(PBYTE)pRecord+sizeof(*pRecord);
aTextValue[31] = '\0';
strcpy(pRecord->Record.pszIcon,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 2. */
pRecord->pszName=(PBYTE)pRecord+sizeof(*pRecord)+1*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszName,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 3. */
pRecord->pszDept__=(PBYTE)pRecord+sizeof(*pRecord)+2*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszDept__,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 4. */
pRecord->pszJob=(PBYTE)pRecord+sizeof(*pRecord)+3*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszJob,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 5. */
pRecord->pszYears=(PBYTE)pRecord+sizeof(*pRecord)+4*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszYears,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 6. */
pRecord->pszSalary=(PBYTE)pRecord+sizeof(*pRecord)+5*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszSalary,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 7. */
pRecord->pszCommision=(PBYTE)pRecord+sizeof(*pRecord)+6*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszCommision,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 8. */
pRecord->pszDepartment=(PBYTE)pRecord+sizeof(*pRecord)+7*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszDepartment,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* ignore. */
fgets (aTextValue, sizeof (aTextValue), file); /* 9. */
pRecord->pszDivision=(PBYTE)pRecord+sizeof(*pRecord)+8*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszDivision,aTextValue);
fgets (aTextValue, sizeof (aTextValue), file); /* 10. */
pRecord->pszLocation=(PBYTE)pRecord+sizeof(*pRecord)+9*32;
aTextValue[31] = '\0';
strcpy (pRecord->pszLocation,aTextValue);
/* add the item to the container */
RecordInsert.cb=sizeof(RECORDINSERT);
RecordInsert.pRecordOrder=(PRECORDCORE)CMA_END;/* add to the end */
RecordInsert.pRecordParent=(PRECORDCORE)0; /* not a child record */
RecordInsert.zOrder=CMA_TOP;
RecordInsert.cRecordsInsert=1;
RecordInsert.fInvalidateRecord=TRUE; /* repaint the record */
WinSendDlgItemMsg(hwndDlg, 1000,
CM_INSERTRECORD,
MPFROMP(pRecord),
MPFROMP(&RecordInsert));
}
} /* end while */
fclose (file);
}