MsgReg2.cpp 5.8 KB

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