void CPropPageSMS::OnBnClickedButtonDel() { // TODO: 在此添加控件通知处理程序代码 CCellID cell = m_gridCtrl.GetFocusCell(); if (!cell.IsValid()) { MessageBox("请先选择要删除的项目","提示"); return; } if (m_nGridCnt>0) { int nRow = cell.row; int nSmsnum,nTxlen; while (nRow<m_nGridCnt) {//从后面往前搬移 // nSmsnum = ((CPCSWApp*)AfxGetApp())->GetSmsInfo(nRow+1,SMS_TXTNUM); // nSmsnum--; nSmsnum = nRow; memcpy(&((CPCSWApp*)AfxGetApp())->m_CommInfo.pShortText[0x00+2+(nRow-1)*SHORTTEXT_STRUCT_LEN], &((CPCSWApp*)AfxGetApp())->m_CommInfo.pShortText[0x00+2+nRow*SHORTTEXT_STRUCT_LEN],SHORTTEXT_STRUCT_LEN); //序号还得改变 ((CPCSWApp*)AfxGetApp())->SetSmsInfo(SMS_TXTNUM,nRow,nSmsnum); nTxlen = ((CPCSWApp*)AfxGetApp())->GetSmsInfo(nRow,SMS_TXTLEN); ((CPCSWApp*)AfxGetApp())->SetSmsInfo(SMS_TXTLEN,nRow,nTxlen); nRow++; } memset(&((CPCSWApp*)AfxGetApp())->m_CommInfo.pShortText[0x00+2+(nRow-1)*SHORTTEXT_STRUCT_LEN], 0x00,SHORTTEXT_STRUCT_LEN); m_nGridCnt--; ((CPCSWApp*)AfxGetApp())->SetSmsCount(m_nGridCnt*SHORTTEXT_STRUCT_LEN);//总数写入 } LoadData(); }
/** @brief Find Replace Dialog @author KHS @date 2009-05-26 오후 1:34:14 @param @return **/ int CGridCtrlEx::OnFind(void) { CCellID cell = GetFocusCell(); if(cell.IsValid()) { m_pFindDialog = new CFindReplaceDialog(); if(m_pFindDialog) { m_pFindDialog->Create(TRUE, "", NULL, FR_DOWN, this); } return ERROR_SUCCESS; } return ERROR_BAD_ENVIRONMENT;; }