// InsideMsg.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "InsideMsg.h" #include "MyMdi.H" #include "ModifyDinDan.h" #include "NeroDlg.h" #include "ShowMsg.h" #include "./helper/ffsco.h" #include "ClientRequirement.h" #include "SendInsideMsg.h" #include "SendInsideMsg2.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #pragma comment(lib, "Shlwapi.lib") ///////////////////////////////////////////////////////////////////////////// // InsideMsg IMPLEMENT_DYNCREATE(InsideMsg, MyFormView) InsideMsg::InsideMsg() : MyFormView(InsideMsg::IDD) { //{{AFX_DATA_INIT(InsideMsg) m_radio1 = 0; m_radio2 = 0; //}}AFX_DATA_INIT g_nYearposTemp=g_nYearpos; } InsideMsg::~InsideMsg() { g_nYearpos=g_nYearposTemp; } void InsideMsg::DoDataExchange(CDataExchange* pDX) { MyFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(InsideMsg) DDX_Control(pDX, IDC_LIST4, m_List2); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Control(pDX, IDC_STATIC1, m_static1); DDX_Radio(pDX, IDC_RADIO1, m_radio1); DDX_Radio(pDX, IDC_RADIO9, m_radio2); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(InsideMsg, MyFormView) //{{AFX_MSG_MAP(InsideMsg) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_RADIO1, OnRadio1) ON_BN_CLICKED(IDC_RADIO2, OnRadio2) ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2) ON_NOTIFY(NM_DBLCLK, IDC_LIST4, OnDblclkList4) ON_BN_CLICKED(IDC_BUTshowphoto, OnDelMsg) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_RADIO9, OnRadio9) ON_BN_CLICKED(IDC_RADIO14, OnRadio14) ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // InsideMsg diagnostics #ifdef _DEBUG void InsideMsg::AssertValid() const { MyFormView::AssertValid(); } void InsideMsg::Dump(CDumpContext& dc) const { MyFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // InsideMsg message handlers void InsideMsg::OnInitialUpdate() { MyFormView::OnInitialUpdate(); m_List1.ShowWindow (SW_HIDE); m_List2.ShowWindow (SW_SHOW); if(IsHasRights2new(49)) { GetDlgItem(IDC_BUTshowphoto)->EnableWindow(1); } else GetDlgItem(IDC_BUTshowphoto)->EnableWindow(0); // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(49))) // GetDlgItem(IDC_RADIO9)->ShowWindow (SW_SHOW); // TODO: Add your specialized code here and/or call the base class CMyMdi Mdi; Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this); // Here we create the outbar control using the splitter as its parent // and setting its id to the first pane. CRect rc2; GetWindowRect(rc2); ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE); EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0); int idarray[]={IDC_BUTTON2,IDC_BUTburncd,IDC_BUTshowphoto,IDC_BUTclose}; int idcount=4; int btnwid; CRect prerc; for(int a=idcount-2; a>=0; a--) { GetDlgItem(idarray[a+1])->GetWindowRect (prerc); ScreenToClient(prerc); GetDlgItem(idarray[a])->GetWindowRect (rc2); ScreenToClient(rc2); btnwid=rc2.Width (); rc2.right =prerc.left ; rc2.left =rc2.right -btnwid; GetDlgItem(idarray[a])->MoveWindow (rc2); } m_static1.SetFont (&g_titlefont); m_List1.SetHeadings("发件人,100;内容,380;时间,160;收件人,100" ); m_List1.LoadColumnInfo (164); m_List2.SetHeadings("发布人,100;内容,380;附件,160;时间,160" ); m_List2.LoadColumnInfo (165); OnButton1(); } void InsideMsg::FillGrid() { UpdateData(); if(m_radio2==0) { m_List2.DeleteAllItems2 (); int ii=0; m_List2.m_arLabels.SetSize( m_List3array.GetSize (), 1 ); int count=0; for(ii=0; iiSendMessage(WM_CLOSE); } BOOL InsideMsg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class try { if(pMsg->message==WM_KEYDOWN) { switch (pMsg->wParam) { case 0x43: // copy if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_COPY); return TRUE; } break; case 0x56: //Ctrl + V: if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_PASTE); return TRUE; } break; case 0x58: // cut if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_CUT); return TRUE; } break; case 0x5A: //undo case 0x59: //redo if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_UNDO); return TRUE; } break; } } return MyFormView::PreTranslateMessage(pMsg); } catch(...) { } } void InsideMsg::OnButton1() { // TODO: Add your control notification handler code here CString str; str="%"; str+=g_user.name; str+="%"; CString filter="[receiver] like '"+str+"' and [receiver]<>'';[sender]='"+g_user.name+"' and [receiver]<>'';[receiver]=''"; g_sendhead.bsql=0; g_sendhead.code[0]=124; g_sendhead.code[1]=125; g_sendhead.code[2]=220; g_sendhead.tabcount=3; if(IsHasRights2new(49)==0) g_pMainWnd->ProcessChatMessageRequest2(filter); else g_pMainWnd->ProcessChatMessageRequest2("[receiver]<>'';[receiver]<>'';[receiver]=''"); if(g_bSendOK==0)return; DataToArray(&m_List1array, &m_List2array, &m_List3array); m_List3arrayBak.SetSize(m_List3array.GetSize ()); for(int i=0; i256) m_List3array.ElementAt (i).SetAt (1, m_List3array.ElementAt (i).ElementAt (1).Left (256)+".."); if(m_List3array.ElementAt (i).ElementAt (2).GetLength ()>256) m_List3array.ElementAt (i).SetAt (2, m_List3array.ElementAt (i).ElementAt (2).Left (256)+".."); } FillGrid(); } void InsideMsg::OnRadio1() { // TODO: Add your control notification handler code here FillGrid(); } void InsideMsg::OnRadio2() { // TODO: Add your control notification handler code here FillGrid(); } void InsideMsg::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要查看的项目!"); return; } int iItem=m_List1.GetNextSelectedItem(pos); CString time=m_List1.GetItemText (iItem, 2); CString filter="[timestamp]='"+time+"'"; g_sendhead.bsql=0; g_sendhead.code[0]=126; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&g_List1array); if(g_List1array.GetSize ()) { ShowMsg dlg; dlg.DoModal (); } // *pResult = 0; } void InsideMsg::OnDblclkList4(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here POSITION pos; pos=m_List2.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要查看的项目!"); return; } int iItem=m_List2.GetNextSelectedItem(pos); CString sender=m_List2.GetItemText (iItem, 0); CString content=m_List2.GetItemText (iItem, 1); CString time=m_List2.GetItemText (iItem, 3); CString filename=m_List2.GetItemText (iItem, 2); for(int ii=0; iiProcessChatMessageRequest2(sql);if(g_bSendOK==0)return; OnButton1(); } else { POSITION pos; pos=m_List2.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要删除的消息!"); return; } if(AfxMessageBox("提醒, 删除后将无法恢复, 是否继续?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return; int iItem=m_List2.GetNextSelectedItem(pos); CString time=m_List2.GetItemText (iItem, 3); CString filename=m_List2.GetItemText (iItem, 2); CString sql="delete from [insidemsg] where [timestamp]='"+time+"'"; g_sendhead.bsql=1; g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return; CString m_path=filename; CString curfile; int pos2=m_path.Find(";"); while(pos2!=-1 || m_path!="") { if(pos2!=-1) curfile=m_path.Left(pos2); else { curfile=m_path; m_path=""; } ::DeleteFile(g_path1+"\\公告附件\\"+curfile); // 删除 公告; if(pos2!=-1) m_path=m_path.Right(m_path.GetLength()-pos2-1); pos2=m_path.Find(";"); } OnButton1(); } } void InsideMsg::OnButton2() { UpdateData(); if(m_radio2==0) { SendInsideMsg2 dlg; dlg.DoModal (); } else { SendInsideMsg dlg; dlg.DoModal (); } OnButton1(); } void InsideMsg::OnRadio9() { // TODO: Add your control notification handler code here m_List1.ShowWindow (SW_HIDE); m_List2.ShowWindow (SW_SHOW); GetDlgItem(IDC_RADIO1)->ShowWindow (SW_HIDE); GetDlgItem(IDC_STATIC4)->ShowWindow (SW_HIDE); GetDlgItem(IDC_RADIO2)->ShowWindow (SW_HIDE); GetDlgItem(IDC_BUTTON2)->SetWindowText ("发布公告"); FillGrid(); } void InsideMsg::OnRadio14() { // TODO: Add your control notification handler code here m_List1.ShowWindow (SW_SHOW); m_List2.ShowWindow (SW_HIDE); GetDlgItem(IDC_RADIO1)->ShowWindow (SW_SHOW); GetDlgItem(IDC_STATIC4)->ShowWindow (SW_SHOW); GetDlgItem(IDC_RADIO2)->ShowWindow (SW_SHOW); GetDlgItem(IDC_BUTTON2)->SetWindowText ("发送邮件"); FillGrid(); } void InsideMsg::OnBUTburncd() { // TODO: Add your control notification handler code here UpdateData(); if(m_radio2) { OnDblclkList2(0,0); } else { OnDblclkList4(0,0); } }