1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
int blnSaveSawData(HWND hParent)
{
MrkData* pMrkData=NULL;
TCHAR szBuffer[8];
HANDLE hFile=NULL;
HWND hCtl=NULL;
int iNum=0;
TREE tree;
pMrkData=(MrkData*)GetWindowLong(hParent,0);
hFile=CreateFile(pMrkData->ofn.lpstrFile,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,FILE_FLAG_RANDOM_ACCESS,NULL);
if(hFile==INVALID_HANDLE_VALUE)
MessageBox(hParent,_T("File Access Problem! Not Good!"),_T("Can't Open File!"),MB_ICONERROR);
else
{
hCtl=GetDlgItem(hParent,IDC_SAW_SPECIES), GetWindowText(hCtl,szBuffer,4), tree.sp=(short)_ttoi(szBuffer);
hCtl=GetDlgItem(hParent,IDC_SAW_DBH), GetWindowText(hCtl,szBuffer,4), tree.dbh=(short)_ttoi(szBuffer);
hCtl=GetDlgItem(hParent,IDC_SAW_HEIGHT), GetWindowText(hCtl,szBuffer,4), tree.ht=(short)_ttoi(szBuffer);
hCtl=GetDlgItem(hParent,IDC_SAW_CULL), GetWindowText(hCtl,szBuffer,4), tree.cull=(short)_ttoi(szBuffer);
hCtl=GetDlgItem(hParent,IDC_BLOCK), GetWindowText(hCtl,szBuffer,4), tree.block=(short)_ttoi(szBuffer);
hCtl=GetDlgItem(hParent,IDC_BLOCK_CTR), GetWindowText(hCtl,szBuffer,7), tree.bkctr=(short)_ttoi(szBuffer);
hCtl=GetDlgItem(hParent,IDC_SAW_NUMBER), GetWindowText(hCtl,szBuffer,7);
iNum=_ttoi(szBuffer);
Put(hFile,iNum,&tree,sizeof(tree));
CloseHandle(hFile);
SetWindowLong(hParent,12,0);
}
return TRUE;
}
|