本文整理汇总了C++中CFile::GetStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::GetStatus方法的具体用法?C++ CFile::GetStatus怎么用?C++ CFile::GetStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetStatus方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBnClickedSetPhoto
void CStaffManageView::OnBnClickedSetPhoto()
{
CString strFilter = _T("BMP图像文件|*.bmp;*.dib||");
CFileDialog dlg(TRUE,NULL,NULL,0,strFilter,this);
if(dlg.DoModal()!=IDOK)
return;
//m_pSet->Edit(); //声明编辑当前记录
CFile filePhoto;
CFileStatus fileStatus;
CString fileLocate = dlg.GetPathName();
filePhoto.Open(fileLocate,CFile::modeRead);
filePhoto.GetStatus(fileStatus);
m_pSet->m_PtrPhoto.m_dwDataLength = (SQLUINTEGER)fileStatus.m_size;
HGLOBAL hGlobal = GlobalAlloc(GPTR,(SIZE_T)fileStatus.m_size);
m_pSet->m_PtrPhoto.m_hData = GlobalLock(hGlobal);
filePhoto.Read(m_pSet->m_PtrPhoto.m_hData,(UINT)fileStatus.m_size);
//把您选择的文件的数据写入m_pSet-m_PtrPhoto
m_pSet->SetFieldDirty(&m_pSet->m_PtrPhoto);
m_pSet->SetFieldNull(&m_pSet->m_PtrPhoto,FALSE);
//m_pSet->Update(); // 更新记录
GlobalUnlock(hGlobal);
CWnd *pPictureWnd = GetDlgItem(IDC_STATIC_PHOTO);
m_hPhotoBitmap = BufferToHBITMAP(pPictureWnd,(char*)m_pSet->m_PtrPhoto.m_hData);
this->RedrawWindow();
}
示例2: IsExist
BOOL IsExist(LPCTSTR strPath)
{
CFile file;
CFileStatus status;
return file.GetStatus(strPath, status);
}
示例3: ODBCInsertOLEImage
bool EVUtil::ODBCInsertOLEImage( EVRecord rec,CString strName )
{
if(m_db.IsOpen())
{
CdbImages rs(&m_db);
rs.Open();
if(rs.IsOpen())
{
rs.AddNew();
CFile fileword;
CFileStatus fileStatus;
fileword.Open(strName,CFile::modeRead);
fileword.GetStatus(fileStatus);
HGLOBAL hGlobal = GlobalAlloc(GPTR,(SIZE_T)fileStatus.m_size);
rs.m_BLOBImage.m_hData = GlobalLock(hGlobal);
fileword.Read(rs.m_BLOBImage.m_hData,(UINT)fileStatus.m_size);
rs.m_BLOBImage.m_dwDataLength=(SQLULEN)fileStatus.m_size;
rs.m_szID = rec.m_szID;
rs.m_szName = rec.m_szName;
rs.m_szArea = rec.m_szArea;
rs.m_szOther=rec.m_szOther;
{
rec.m_szDate.TrimLeft();
rec.m_szDate.TrimRight();
if(!rs.m_szDate.ParseDateTime(rec.m_szDate))
{
int a=0,b=0,c=0;
sscanf(rec.m_szDate.GetBuffer(rec.m_szDate.GetLength()),"%d年%d月%d日",&a,&b,&c);
rs.m_szDate.SetDate(a,b,c);
}
rec.m_szCreateTime.TrimLeft();
rec.m_szCreateTime.TrimRight();
if(!rs.m_szCreateTime.ParseDateTime(rec.m_szCreateTime))
{
int a=0,b=0,c=0;
sscanf(rec.m_szCreateTime.GetBuffer(rec.m_szCreateTime.GetLength()),"%d年%d月%d日",&a,&b,&c);
rs.m_szCreateTime.SetDate(a,b,c);
}
}
rs.m_szInfo = rec.m_szInfo;
rs.m_b1=rec.m_bMetal;
rs.m_b2 = rec.m_bPos;
rs.m_b3 = rec.m_bDirect;
rs.m_b4= rec.m_bMark;
rs.m_bOut = FALSE;
rs.m_szPointData = rec.m_szPointData;
rs.SetFieldDirty(&rs.m_BLOBImage,TRUE);
rs.SetFieldDirty(&rs.m_szPointData);
rs.SetFieldNull (&rs.m_BLOBImage,NULL);
rs.Update();
GlobalUnlock(hGlobal);
}
rs.Close();
return true;
}
return false;
}
示例4: ODBCUpdateOLEImage
bool EVUtil::ODBCUpdateOLEImage( int iID,CString strName )
{
if ( strName.GetLength()<1 )
{
return false;
}
if(m_db.IsOpen())
{
CdbImages rs(&m_db);
rs.Open();
if(rs.IsOpen())
{
rs.MoveFirst();
while(!rs.IsEOF())
{
if ( rs.m_iID!=iID )
{
rs.MoveNext();
continue;
}
rs.Edit();
CFile fileword;
CFileStatus fileStatus;
fileword.Open(strName,CFile::modeRead);
fileword.GetStatus(fileStatus);
HGLOBAL hGlobal = GlobalAlloc(GPTR,(size_t)fileStatus.m_size);
rs.m_BLOBImage.m_hData = GlobalLock(hGlobal);
fileword.Read(rs.m_BLOBImage.m_hData,(UINT)fileStatus.m_size);
rs.m_BLOBImage.m_dwDataLength=(SQLULEN)fileStatus.m_size;
rs.SetFieldDirty(&rs.m_BLOBImage,TRUE);
rs.SetFieldNull (&rs.m_BLOBImage,NULL);
rs.Update();
GlobalUnlock(hGlobal);
break;
}
}
rs.Close();
return true;
}
return false;
}
示例5: ODBCSetOLEImage
bool EVUtil::ODBCSetOLEImage( int iID,CString strName )
{
if(m_db.IsOpen())
{
CString sql;
sql.Format(_T("select * FROM 数据 WHERE ID = %d"),iID);
CdbImages rs(&m_db);
rs.Open();
if(rs.IsOpen())
{
rs.MoveFirst();
while(!rs.IsEOF())
{
if ( rs.m_iID!=iID )
{
rs.MoveNext();
continue;
}
rs.Edit();
CFile fileword;
CFileStatus fileStatus;
fileword.Open(strName,CFile::modeRead);
fileword.GetStatus(fileStatus);
HGLOBAL hGlobal = GlobalAlloc(GPTR,(SIZE_T)fileStatus.m_size);
rs.m_BLOBImage.m_hData = GlobalLock(hGlobal);
fileword.Read(rs.m_BLOBImage.m_hData,(UINT)fileStatus.m_size);
rs.m_BLOBImage.m_dwDataLength=(SQLULEN)fileStatus.m_size;
rs.SetFieldDirty(&rs.m_BLOBImage,TRUE);
rs.SetFieldNull (&rs.m_BLOBImage,NULL);
rs.Update();
GlobalUnlock(hGlobal);
rs.Close();
return true;
}
rs.Close();
}
}
return false;
}
示例6: ReadFile
//reads ini file specified using CIniFile::SetPath()
//returns true if successful, false otherwise
CString CIniFile::ReadFile(CString filename)
{
CFile file;
CFileStatus status;
if (!file.GetStatus(filename,status))
return "Ooops";//by ny
ifstream inifile;
CString readinfo;
inifile.open(filename);
int curkey = -1, curval = -1;
if (inifile.fail())
{
error = "Unable to open ini file.";
return "Unable to open ini file.";//by ny
}
CString keyname, valuename, value;
CString temp;
while (getline(inifile,readinfo))
{
if (readinfo != "")
{
if (readinfo[0] == '[' && readinfo[readinfo.GetLength()-1] == ']') //if a section heading
{
keyname = readinfo;
keyname.TrimLeft('[');
keyname.TrimRight(']');
}
else //if a value
{
valuename = readinfo.Left(readinfo.Find("="));
value = readinfo.Right(readinfo.GetLength()-valuename.GetLength()-1);
SetValue(keyname,valuename,value);
}
}
}
inifile.close();
return valuename;
}