標籤:style 資料 os 資料庫 sql window
1.實現背景
在插入list行時用郵件的MessageID給對應行命名。
在回複全部郵件時,收件者變為之前收件者中出去“自己”同時加入之前寄件者,抄送人還是之前的抄送人,密送人不用管,直接不用帶。
在“回複全部”按鈕響應函數裡面
CListUI* pList = static_cast<CListUI*>(m_PaintManager.FindControl(_T("middle_comlumn_header1")));//拿到list控制項指標
int index = pList->GetCurSel();//擷取當前選中行
CControlUI* pControl = pList->GetItemAt(index);//擷取對應行控制項指標
string strMsgID = UTF(pControl->GetName().GetData());//擷取對應行控制項名字
const char* gszFile ="WebMail.sqlite";
CppSQLite3DB *pDB=new CppSQLite3DB;
pDB->open(gszFile);
string strSql;
strSql="SELECT mFrom,mTo,mCc,mSubject FROM Email where mMessageID =‘";//在資料庫裡面查到對應mMessageID記錄
strSql+= strMsgID;
strSql+="‘";
CppSQLite3Query query=pDB->execQuery(strSql.c_str());
string StrFrom,StrTo,StrCC,StrSub,temp;
StrFrom = query.getStringField("mFrom");
StrTo=query.getStringField("mTo");
temp=m_Imap.ms_User;//要除去的目標字串
int pos = StrTo.find(temp,0);//找到目標字串所在位置
StrTo=StrTo.substr(0,pos-1)+StrTo.substr(pos+temp.length(),StrTo.length()-(pos+temp.length()));
StrTo+=";";
StrTo+=StrFrom;
StrCC=query.getStringField("mCc");
StrSub=query.getStringField("mSubject");
StrSub.insert(0,"RE: ");
query.finalize();
pDB->close();
vector<string> data;
data.push_back(StrTo);
data.push_back(StrCC);
data.push_back(StrSub);
CWriteWnd* pWrite=new CWriteWnd(_T("WriteWnd.xml"),m_Imap,data);
pWrite->Create(NULL, _T("WriteWnd"), UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE | WS_EX_ACCEPTFILES);
pWrite->CenterWindow();
pWrite->ShowModal();