MsgReg2.cpp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. // MsgReg2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "MsgReg2.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "TakeMoney2.h"
  10. #include "NeroDlg.h"
  11. #include "ClientRequirement.h"
  12. #include "ChoosePhotoSkin2.h"
  13. #include "./helper/ffsco.h"
  14. #include "ClientRequirement.h"
  15. #include "MsgCode.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. #pragma comment(lib, "Shlwapi.lib")
  22. /////////////////////////////////////////////////////////////////////////////
  23. // MsgReg2
  24. IMPLEMENT_DYNCREATE(MsgReg2, MyFormView)
  25. MsgReg2::MsgReg2()
  26. : MyFormView(MsgReg2::IDD)
  27. {
  28. //{{AFX_DATA_INIT(MsgReg2)
  29. //}}AFX_DATA_INIT
  30. g_nYearposTemp = g_nYearpos;
  31. }
  32. MsgReg2::~MsgReg2()
  33. {
  34. g_nYearpos = g_nYearposTemp;
  35. }
  36. void MsgReg2::DoDataExchange(CDataExchange* pDX)
  37. {
  38. MyFormView::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(MsgReg2)
  40. DDX_Control(pDX, IDC_LIST6, m_List3);
  41. DDX_Control(pDX, IDC_STATIC1, m_static1);
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP(MsgReg2, MyFormView)
  45. //{{AFX_MSG_MAP(MsgReg2)
  46. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  47. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  48. ON_BN_CLICKED(IDC_BUTshowphoto, OnDelMsg)
  49. ON_NOTIFY(NM_DBLCLK, IDC_LIST6, OnDblclkList6)
  50. ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // MsgReg2 diagnostics
  55. #ifdef _DEBUG
  56. void MsgReg2::AssertValid() const
  57. {
  58. MyFormView::AssertValid();
  59. }
  60. void MsgReg2::Dump(CDumpContext& dc) const
  61. {
  62. MyFormView::Dump(dc);
  63. }
  64. #endif //_DEBUG
  65. /////////////////////////////////////////////////////////////////////////////
  66. // MsgReg2 message handlers
  67. void MsgReg2::OnInitialUpdate()
  68. {
  69. MyFormView::OnInitialUpdate();
  70. if (IsHasRights2new(49))
  71. {
  72. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(1);
  73. }
  74. else
  75. {
  76. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(0);
  77. GetDlgItem(IDC_BUTburncd)->EnableWindow(0);
  78. }
  79. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(49)))
  80. // GetDlgItem(IDC_RADIO9)->ShowWindow (SW_SHOW);
  81. // TODO: Add your specialized code here and/or call the base class
  82. CMyMdi Mdi;
  83. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  84. // Here we create the outbar control using the splitter as its parent
  85. // and setting its id to the first pane.
  86. CRect rc2;
  87. GetWindowRect(rc2);
  88. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  89. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  90. m_static1.SetFont(&g_titlefont);
  91. m_List3.SetHeadings("客人,100;电话,100;内容,200;时间,150;解释,200");
  92. m_List3.LoadColumnInfo(251);
  93. OnButton1();
  94. }
  95. void MsgReg2::FillGrid()
  96. {
  97. UpdateData();
  98. m_List3.DeleteAllItems2();
  99. int ii = 0;
  100. m_List3.m_arLabels.SetSize(m_List3array.GetSize(), 1);
  101. int count = 0;
  102. for (ii = 0; ii < m_List3.m_arLabels.GetSize(); ii++)
  103. {
  104. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  105. }
  106. m_List3.m_arLabels.SetSize(count, 1);
  107. ii = count;
  108. m_List3.m_LabelCount = ii;
  109. m_List3.SetItemCountEx(ii);
  110. }
  111. void MsgReg2::OnBUTclose()
  112. {
  113. // TODO: Add your control notification handler code here
  114. GetParent()->SendMessage(WM_CLOSE);
  115. }
  116. BOOL MsgReg2::PreTranslateMessage(MSG* pMsg)
  117. {
  118. // TODO: Add your specialized code here and/or call the base class
  119. try
  120. {
  121. if (pMsg->message == WM_KEYDOWN)
  122. {
  123. switch (pMsg->wParam)
  124. {
  125. case 0x43: // copy
  126. if ((GetKeyState(VK_CONTROL) & 0x80))
  127. {
  128. GetFocus()->SendMessage(WM_COPY);
  129. return TRUE;
  130. }
  131. break;
  132. case 0x56: //Ctrl + V:
  133. if ((GetKeyState(VK_CONTROL) & 0x80))
  134. {
  135. GetFocus()->SendMessage(WM_PASTE);
  136. return TRUE;
  137. }
  138. break;
  139. case 0x58: // cut
  140. if ((GetKeyState(VK_CONTROL) & 0x80))
  141. {
  142. GetFocus()->SendMessage(WM_CUT);
  143. return TRUE;
  144. }
  145. break;
  146. case 0x5A: //undo
  147. case 0x59: //redo
  148. if ((GetKeyState(VK_CONTROL) & 0x80))
  149. {
  150. GetFocus()->SendMessage(WM_UNDO);
  151. return TRUE;
  152. }
  153. break;
  154. }
  155. }
  156. return MyFormView::PreTranslateMessage(pMsg);
  157. }
  158. catch (...)
  159. {
  160. }
  161. }
  162. void MsgReg2::OnButton1()
  163. {
  164. // TODO: Add your control notification handler code here
  165. g_sendhead.bsql = 0;
  166. g_sendhead.code[0] = 214;
  167. g_sendhead.tabcount = 1;
  168. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  169. DataToArray(&m_List3array);
  170. FillGrid();
  171. }
  172. void MsgReg2::OnDelMsg()
  173. {
  174. // TODO: Add your control notification handler code here
  175. if (IsHasRights2new(49) == 0)return;
  176. UpdateData();
  177. {
  178. POSITION pos;
  179. pos = m_List3.GetFirstSelectedItemPosition();
  180. if (pos == NULL)
  181. {
  182. AfxMessageBox("请先选中您要删除的短信!");
  183. return;
  184. }
  185. if (AfxMessageBox("提醒, 删除后将无法恢复, 是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  186. int iItem = m_List3.GetNextSelectedItem(pos);
  187. CString time = m_List3.GetItemText(iItem, 3);
  188. CString content = m_List3.GetItemText(iItem, 2);
  189. CString sql = "delete from sendregreceive where [timestamp]='" + time + "' and [content]='" + content + "'";
  190. g_sendhead.bsql = 1;
  191. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  192. OnButton1();
  193. }
  194. }
  195. void MsgReg2::OnDblclkList6(NMHDR* pNMHDR, LRESULT* pResult)
  196. {
  197. // TODO: Add your control notification handler code here
  198. POSITION pos;
  199. pos = m_List3.GetFirstSelectedItemPosition();
  200. if (pos == NULL)
  201. {
  202. return;
  203. }
  204. int iItem = m_List3.GetNextSelectedItem(pos);
  205. CString time = m_List3.GetItemText(iItem, 3);
  206. CString content = m_List3.GetItemText(iItem, 2);
  207. CString filter = "[timestamp]='" + time + "' and [content]='" + content + "'";
  208. g_sendhead.bsql = 0;
  209. g_sendhead.code[0] = 119;
  210. g_sendhead.tabcount = 1;
  211. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  212. DataToArray(&g_List1array);
  213. if (g_List1array.GetSize())
  214. {
  215. CClientRequirement dlg;
  216. dlg.m_bSave = 0;
  217. dlg.m_nMode = 1;
  218. dlg.m_bz2 = g_List1array.ElementAt(0).ElementAt(2);
  219. dlg.DoModal();
  220. }
  221. *pResult = 0;
  222. }
  223. void MsgReg2::OnBUTburncd()
  224. {
  225. // TODO: Add your control notification handler code here
  226. MsgCode dlg;
  227. dlg.DoModal();
  228. }