LogForm.cpp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. // LogFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "LogForm.h"
  6. #include "MyMdi.H"
  7. #include "InputPsw.h"
  8. #include "mysqldata.h"
  9. #include "InputPsw.h"
  10. #include "ShowHistoryReg.h"
  11. #include "SetClientIPDlg.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. #pragma comment(lib, "Shlwapi.lib")
  18. /////////////////////////////////////////////////////////////////////////////
  19. // LogFrom IDC_STATIC2
  20. IMPLEMENT_DYNCREATE(LogFrom, CFormView)
  21. LogFrom::LogFrom()
  22. : CFormView(LogFrom::IDD)
  23. {
  24. //{{AFX_DATA_INIT(LogFrom)
  25. m_filter = _T("");
  26. //}}AFX_DATA_INIT
  27. }
  28. LogFrom::~LogFrom()
  29. {
  30. }
  31. void LogFrom::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CFormView::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(LogFrom)
  35. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  36. DDX_Control(pDX, IDC_LIST2, m_List1);
  37. DDX_Control(pDX, IDC_STATIC1, m_static1);
  38. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(LogFrom, CFormView)
  42. //{{AFX_MSG_MAP(LogFrom)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  48. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  49. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  50. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  51. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  52. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  53. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  54. ON_BN_CLICKED(IDC_BUTimportphoto2, OnBUTimportphoto2)
  55. //}}AFX_MSG_MAP
  56. END_MESSAGE_MAP()
  57. /////////////////////////////////////////////////////////////////////////////
  58. // LogFrom diagnostics
  59. #ifdef _DEBUG
  60. void LogFrom::AssertValid() const
  61. {
  62. CFormView::AssertValid();
  63. }
  64. void LogFrom::Dump(CDumpContext& dc) const
  65. {
  66. CFormView::Dump(dc);
  67. }
  68. #endif //_DEBUG
  69. /////////////////////////////////////////////////////////////////////////////
  70. // LogFrom message handlers
  71. void LogFrom::OnInitialUpdate()
  72. {
  73. CFormView::OnInitialUpdate();
  74. // TODO: Add your specialized code here and/or call the base class
  75. CMyMdi Mdi;
  76. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  77. // Here we create the outbar control using the splitter as its parent
  78. // and setting its id to the first pane.
  79. CRect rc2;
  80. GetWindowRect(rc2);
  81. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  82. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  83. m_static1.SetFont (&g_titlefont);
  84. m_List1.SetHeadings("ÈÕÖ¾,550" );
  85. m_List1.LoadColumnInfo (_T("114"));
  86. m_combo1.GetWindowRect (rc2);
  87. ScreenToClient(rc2);
  88. rc2.bottom +=200;
  89. m_combo1.MoveWindow (rc2);
  90. OnButton1();
  91. }
  92. void LogFrom::FillGrid(BOOL bStatus)
  93. {
  94. m_List1.DeleteAllItems2 ();
  95. int ii=0;
  96. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  97. int count=0;
  98. if(m_filter.IsEmpty ())
  99. {
  100. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  101. {
  102. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  103. }
  104. }
  105. else
  106. {
  107. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  108. {
  109. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1)
  110. {
  111. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  112. }
  113. }
  114. }
  115. m_List1.m_arLabels.SetSize(count, 1);
  116. ii=count;
  117. m_List1.m_LabelCount=ii;
  118. m_List1.SetItemCountEx (ii);
  119. }
  120. void LogFrom::OnBUTclose()
  121. {
  122. // TODO: Add your control notification handler code here
  123. GetParent()->SendMessage(WM_CLOSE);
  124. }
  125. void LogFrom::OnSelchangeCombo1()
  126. {
  127. // TODO: Add your control notification handler code here
  128. SetTimer(1, 100, NULL);
  129. }
  130. void LogFrom::OnTimer(UINT nIDEvent)
  131. {
  132. // TODO: Add your message handler code here and/or call default
  133. KillTimer(nIDEvent);
  134. OnButton1();
  135. }
  136. BOOL LogFrom::PreTranslateMessage(MSG* pMsg)
  137. {
  138. // TODO: Add your specialized code here and/or call the base class
  139. try
  140. {
  141. if(pMsg->message==WM_KEYDOWN)
  142. {
  143. switch (pMsg->wParam)
  144. {
  145. case VK_RETURN:
  146. OnButton1();
  147. return 1;
  148. case 0x43: // copy
  149. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  150. {
  151. GetFocus()->SendMessage(WM_COPY);
  152. return TRUE;
  153. }
  154. break;
  155. case 0x56: //Ctrl + V:
  156. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  157. {
  158. GetFocus()->SendMessage(WM_PASTE);
  159. return TRUE;
  160. }
  161. break;
  162. case 0x58: // cut
  163. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  164. {
  165. GetFocus()->SendMessage(WM_CUT);
  166. return TRUE;
  167. }
  168. break;
  169. case 0x5A: //undo
  170. case 0x59: //redo
  171. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  172. {
  173. GetFocus()->SendMessage(WM_UNDO);
  174. return TRUE;
  175. }
  176. break;
  177. }
  178. }
  179. return CFormView::PreTranslateMessage(pMsg);
  180. }
  181. catch(...)
  182. {
  183. }
  184. }
  185. void LogFrom::OnBUTmoney()
  186. {
  187. // TODO: Add your control notification handler code here
  188. }
  189. void LogFrom::OnBTNaddsp()
  190. {
  191. }
  192. void LogFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  193. {
  194. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  195. // TODO: Add your control notification handler code here
  196. *pResult = 0;
  197. }
  198. extern void ConvertToPrice(CString &str);
  199. void LogFrom::OnButton1()
  200. {
  201. // TODO: Add your control notification handler code here
  202. CStdioFile fp;
  203. CString path=g_mainpath+"\\LYFZIPReceive.txt";
  204. m_List1array.RemoveAll ();
  205. CStringArray array;
  206. if(::PathFileExists (path))
  207. {
  208. CString str;
  209. fp.Open (path, CFile::modeRead);
  210. while(!feof(fp.m_pStream))
  211. {
  212. fp.ReadString (str );
  213. str.TrimLeft ();str.TrimRight ();
  214. if(str.IsEmpty ()==0)
  215. array.Add (str);
  216. }
  217. fp.Close ();
  218. }
  219. if(array.GetSize ())
  220. {
  221. m_List1array.SetSize(array.GetSize () , 1 );
  222. int size=0;
  223. for(int i=array.GetSize ()-1; i>=0; i--)
  224. {
  225. m_List1array.ElementAt (size).Add (array.ElementAt (i));size++;
  226. }
  227. }
  228. UpdateData();
  229. FillGrid();
  230. }
  231. void LogFrom::OnBUTshowphoto() //ÀúÊ·³åÖµ
  232. {
  233. }
  234. void LogFrom::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  235. {
  236. // TODO: Add your control notification handler code here
  237. POSITION pos;
  238. pos=m_List1.GetFirstSelectedItemPosition();
  239. if(pos==NULL)
  240. {
  241. return;
  242. }
  243. int iItem=m_List1.GetNextSelectedItem(pos);
  244. CString m_name=m_List1.GetItemText (iItem, 2);
  245. CString ip=m_List1.GetItemText (iItem, 3);
  246. SetClientIPDlg dlg;
  247. dlg.m_mode =1;
  248. dlg.m_name =m_name;
  249. dlg.m_ip =ip;
  250. if(dlg.DoModal ()==IDOK)
  251. OnButton1();
  252. *pResult = 0;
  253. }
  254. void LogFrom::OnBUTimportphoto() //Ìí¼Ó¿Í»§
  255. {
  256. // TODO: Add your control notification handler code here
  257. SetClientIPDlg dlg;
  258. POSITION pos;
  259. pos=m_List1.GetFirstSelectedItemPosition();
  260. if(pos!=NULL)
  261. {
  262. int iItem=m_List1.GetNextSelectedItem(pos);
  263. dlg.m_enterprisename=m_List1.GetItemText (iItem, 0);
  264. dlg.m_branchname=m_List1.GetItemText (iItem, 1);
  265. dlg.m_name=m_List1.GetItemText (iItem, 2);
  266. }
  267. if(dlg.DoModal ()==IDOK)
  268. OnButton1();
  269. }
  270. void LogFrom::OnBUTimportphoto2()
  271. {
  272. // TODO: Add your control notification handler code here
  273. CString sql;
  274. sql="delete from noregisterdomain";
  275. MyExecuteSQL(&g_db, sql);
  276. }
  277. void LogFrom::OnButton2()
  278. {
  279. CString path=g_mainpath+"\\LYFZIPReceive.txt";
  280. ::DeleteFile (path);
  281. OnButton1();
  282. }