判斷文件是否存在洲脂,并做相應(yīng)的操作赎瑰。
CString im;
im = "C:\\Users\\Administrator\\Desktop\\test\\菊花.bmp";
CFile file;
if (file.Open(im, CFile::modeRead))
{
AfxMessageBox(_T("hahah"));
file.Close();
}
獲取當(dāng)前時(shí)間
CString my_date;
CTime tm;
tm = CTime::GetCurrentTime();
my_date = tm.Format("%Y-%m-%d %H:%M:%S");
獲取最新的ID
strSql_temp = "select MAX(ID) from USERINFO;";
m_Ado_temp.GetRecordSet(strSql_temp);
CString oo;
oo = m_Ado_temp.m_pRecordset->GetCollect("");
文件操作
//文件讀寫操作
TCHAR* pszFileName = _T("c:\\login.txt");
CFilemyFile;
int len;
if (myFile.Open(pszFileName, CFile::modeCreate
| CFile::modeReadWrite, NULL))
{
len = dlg.currentUser.GetLength();
myFile.Write(dlg.currentUser, len);
}
移動(dòng)窗口的位置
CRect winRect;
GetWindowRect(winRect);
winRect.bottom += 15;
winRect.top += 15;
MoveWindow(winRect);
移動(dòng)控件的位置
CRect rect;
//獲得空間的絕對(duì)坐標(biāo)
GetDlgItem(IDCANCEL)->GetWindowRect(&rect);
//獲得相對(duì)于主窗體的坐標(biāo)
ScreenToClient(&rect);
//這里是要移動(dòng)的相對(duì)位置
rect.OffsetRect(CSize(0, -50));
GetDlgItem(IDCANCEL)->MoveWindow(rect);