ClientIPForm2.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. // ClientIPFrom2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "ClientIPForm2.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. #include "InputDate.h"
  13. #include "PayOutSet.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. #pragma comment(lib, "Shlwapi.lib")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // ClientIPFrom2 IDC_STATIC2
  22. IMPLEMENT_DYNCREATE(ClientIPFrom2, CFormView)
  23. ClientIPFrom2::ClientIPFrom2()
  24. : CFormView(ClientIPFrom2::IDD)
  25. {
  26. //{{AFX_DATA_INIT(ClientIPFrom2)
  27. m_filter = _T("");
  28. //}}AFX_DATA_INIT
  29. }
  30. ClientIPFrom2::~ClientIPFrom2()
  31. {
  32. }
  33. void ClientIPFrom2::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CFormView::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(ClientIPFrom2)
  37. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  38. DDX_Control(pDX, IDC_LIST2, m_List1);
  39. DDX_Control(pDX, IDC_STATIC1, m_static1);
  40. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(ClientIPFrom2, CFormView)
  44. //{{AFX_MSG_MAP(ClientIPFrom2)
  45. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  46. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  47. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  48. ON_WM_TIMER()
  49. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  50. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  51. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  52. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  53. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  54. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  55. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  56. ON_BN_CLICKED(IDC_BUTimportphoto2, OnBUTimportphoto2)
  57. ON_BN_CLICKED(IDC_BUTmoney4, OnBUTmoney4)
  58. ON_BN_CLICKED(IDC_BUTmoney5, OnBUTmoney5)
  59. //}}AFX_MSG_MAP
  60. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList1)
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // ClientIPFrom2 diagnostics
  64. #ifdef _DEBUG
  65. void ClientIPFrom2::AssertValid() const
  66. {
  67. CFormView::AssertValid();
  68. }
  69. void ClientIPFrom2::Dump(CDumpContext& dc) const
  70. {
  71. CFormView::Dump(dc);
  72. }
  73. #endif //_DEBUG
  74. /////////////////////////////////////////////////////////////////////////////
  75. // ClientIPFrom2 message handlers
  76. void ClientIPFrom2::OnInitialUpdate()
  77. {
  78. CFormView::OnInitialUpdate();
  79. // TODO: Add your specialized code here and/or call the base class
  80. CMyMdi Mdi;
  81. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  82. // Here we create the outbar control using the splitter as its parent
  83. // and setting its id to the first pane.
  84. CRect rc2;
  85. GetWindowRect(rc2);
  86. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  87. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  88. m_static1.SetFont (&g_titlefont);
  89. m_List1.SetHeadings("域名,100;店名,100;电话,100;地址,100;店长,100;单数(当前/总),100;版本号,100;IP,100;刷新时间,100;控制,100" );
  90. m_List1.LoadColumnInfo (125);
  91. m_combo1.GetWindowRect (rc2);
  92. ScreenToClient(rc2);
  93. rc2.bottom +=200;
  94. m_combo1.MoveWindow (rc2);
  95. OnButton1();
  96. }
  97. void ClientIPFrom2::FillGrid(BOOL bStatus)
  98. {
  99. m_List1.DeleteAllItems2 ();
  100. int ii=0;
  101. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  102. int count=0;
  103. if(m_filter.IsEmpty ())
  104. {
  105. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  106. {
  107. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  108. }
  109. }
  110. else
  111. {
  112. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  113. {
  114. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 \
  115. ||m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 \
  116. || m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 \
  117. || m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 \
  118. || m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 \
  119. || m_List1array.ElementAt (ii).ElementAt (5).Find (m_filter)!=-1 )
  120. {
  121. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  122. }
  123. }
  124. }
  125. m_List1.m_arLabels.SetSize(count, 1);
  126. ii=count;
  127. m_List1.m_LabelCount=ii;
  128. m_List1.SetItemCountEx (ii);
  129. CString str;
  130. str.Format ("数量:%d", ii);
  131. SetDlgItemText(IDC_STATIC2, str);
  132. }
  133. void ClientIPFrom2::OnBUTclose()
  134. {
  135. // TODO: Add your control notification handler code here
  136. GetParent()->SendMessage(WM_CLOSE);
  137. }
  138. void ClientIPFrom2::OnSelchangeCombo1()
  139. {
  140. // TODO: Add your control notification handler code here
  141. SetTimer(1, 100, NULL);
  142. }
  143. void ClientIPFrom2::OnTimer(UINT nIDEvent)
  144. {
  145. // TODO: Add your message handler code here and/or call default
  146. KillTimer(nIDEvent);
  147. OnButton1();
  148. }
  149. BOOL ClientIPFrom2::PreTranslateMessage(MSG* pMsg)
  150. {
  151. // TODO: Add your specialized code here and/or call the base class
  152. try
  153. {
  154. if(pMsg->message==WM_KEYDOWN)
  155. {
  156. switch (pMsg->wParam)
  157. {
  158. case VK_RETURN:
  159. OnButton1();
  160. return 1;
  161. case 0x43: // copy
  162. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  163. {
  164. GetFocus()->SendMessage(WM_COPY);
  165. return TRUE;
  166. }
  167. break;
  168. case 0x56: //Ctrl + V:
  169. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  170. {
  171. GetFocus()->SendMessage(WM_PASTE);
  172. return TRUE;
  173. }
  174. break;
  175. case 0x58: // cut
  176. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  177. {
  178. GetFocus()->SendMessage(WM_CUT);
  179. return TRUE;
  180. }
  181. break;
  182. case 0x5A: //undo
  183. case 0x59: //redo
  184. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  185. {
  186. GetFocus()->SendMessage(WM_UNDO);
  187. return TRUE;
  188. }
  189. break;
  190. }
  191. }
  192. return CFormView::PreTranslateMessage(pMsg);
  193. }
  194. catch(...)
  195. {
  196. }
  197. }
  198. void ClientIPFrom2::OnBTNaddsp()
  199. {
  200. }
  201. void ClientIPFrom2::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  202. {
  203. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  204. // TODO: Add your control notification handler code here
  205. *pResult = 0;
  206. }
  207. extern void ConvertToPrice(CString &str);
  208. void ClientIPFrom2::OnButton1() // 查询;
  209. {
  210. // TODO: Add your control notification handler code here
  211. if(1)
  212. { MyLock lock("xiaoaccessdbmsg");
  213. CRecordset myset(&g_db);
  214. CString sql="select count(*) as cot from [softclient]";
  215. myset.Open (CRecordset::forwardOnly, sql);
  216. myset.GetFieldValue ("cot", sql);
  217. myset.Close();
  218. m_List1array.SetSize(atol(sql) , 1 );
  219. CRstSoftClient rsSt;
  220. rsSt.Open();
  221. DWORD ii=0;
  222. while(!rsSt.IsEOF())
  223. {
  224. m_List1array.ElementAt (ii).RemoveAll ();
  225. m_List1array.ElementAt (ii).Add(rsSt.domain) ;
  226. m_List1array.ElementAt (ii).Add(rsSt.name) ;
  227. m_List1array.ElementAt (ii).Add(rsSt.phone) ;
  228. m_List1array.ElementAt (ii).Add(rsSt.addr) ;
  229. m_List1array.ElementAt (ii).Add(rsSt.admin) ;
  230. m_List1array.ElementAt (ii).Add(rsSt.cot) ;
  231. m_List1array.ElementAt (ii).Add(rsSt.version) ;
  232. m_List1array.ElementAt (ii).Add(rsSt.ip) ;
  233. m_List1array.ElementAt (ii).Add(rsSt.datetime) ;
  234. if(rsSt.ret=="g_bInSkin")
  235. m_List1array.ElementAt (ii).Add("已控制") ;
  236. else
  237. m_List1array.ElementAt (ii).Add("") ;
  238. ii++;
  239. rsSt.MoveNext();if(m_List1array.GetSize ()<=ii)break;
  240. }
  241. rsSt.Close();m_List1array.SetSize(ii , 1 );
  242. }
  243. UpdateData();
  244. m_filter.TrimLeft ();
  245. m_filter.TrimRight ();
  246. FillGrid();
  247. }
  248. void ClientIPFrom2::OnBUTshowphoto() // 远程控制;
  249. {
  250. POSITION pos;
  251. pos=m_List1.GetFirstSelectedItemPosition();
  252. if(pos==NULL)
  253. {
  254. AfxMessageBox("请先选中您要控制的项目!", MB_ICONINFORMATION);
  255. return;
  256. }
  257. if(AfxMessageBox("警告:此操作将会导致该店数据,照片加密,无法使用软件, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  258. InputPsw dlg;
  259. if(dlg.DoModal()!=IDOK)return;
  260. int iItem=m_List1.GetNextSelectedItem(pos);
  261. CString domain=m_List1.GetItemText (iItem, 0);
  262. CString name=m_List1.GetItemText (iItem, 1);
  263. CString phone=m_List1.GetItemText (iItem, 2);
  264. CString sql;
  265. sql= "update [softclient] set [ret]='g_bInSkin' where [domain]='"+domain+"' and [name]='"+name+"' and [phone]='"+phone+"' ";
  266. MyExecuteSQL(&g_db, sql);
  267. OnButton1();
  268. }
  269. void ClientIPFrom2::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  270. {
  271. // TODO: Add your control notification handler code here
  272. *pResult = 0;
  273. }
  274. void ClientIPFrom2::OnBUTimportphoto() // 添加域名;
  275. {
  276. // TODO: Add your control notification handler code here
  277. SetClientIPDlg dlg;
  278. POSITION pos;
  279. pos=m_List1.GetFirstSelectedItemPosition();
  280. if(pos!=NULL)
  281. {
  282. int iItem=m_List1.GetNextSelectedItem(pos);
  283. dlg.m_enterprisename=m_List1.GetItemText (iItem, 0);
  284. dlg.m_branchname=m_List1.GetItemText (iItem, 1);
  285. dlg.m_name=m_List1.GetItemText (iItem, 2);
  286. }
  287. if(dlg.DoModal ()==IDOK)
  288. OnButton1();
  289. }
  290. void ClientIPFrom2::OnBUTimportphoto2() // 清除IP;
  291. {
  292. POSITION pos;
  293. pos=m_List1.GetFirstSelectedItemPosition();
  294. if(pos==NULL)
  295. {
  296. return;
  297. }
  298. int iItem=m_List1.GetNextSelectedItem(pos);
  299. CString account=m_List1.GetItemText (iItem, 2);
  300. CString sql;
  301. sql= "update clientip set [ip]='' where [name]='"+account+"'";
  302. MyExecuteSQL(&g_db, sql);
  303. OnButton1();
  304. }
  305. void ClientIPFrom2::OnButton2()
  306. {
  307. POSITION pos;
  308. pos=m_List1.GetFirstSelectedItemPosition();
  309. if(pos==NULL)
  310. {
  311. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
  312. return;
  313. }
  314. // if(AfxMessageBox("警告:删除后将不可恢复, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  315. // InputPsw dlg;
  316. // if(dlg.DoModal()!=IDOK)return;
  317. int iItem=m_List1.GetNextSelectedItem(pos);
  318. CString domain=m_List1.GetItemText (iItem, 0);
  319. CString name=m_List1.GetItemText (iItem, 1);
  320. CString phone=m_List1.GetItemText (iItem, 2);
  321. CString sql;
  322. sql= "delete from softclient where [domain]='"+domain+"' and [name]='"+name+"' and [phone]='"+phone+"' ";
  323. MyExecuteSQL(&g_db, sql);
  324. OnButton1();
  325. }
  326. void ClientIPFrom2::OnCustomdrawList1 ( NMHDR* pNMHDR, LRESULT* pResult )
  327. {
  328. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  329. // Take the default processing unless we set this to something else below.
  330. *pResult = 0;
  331. // First thing - check the draw stage. If it's the control's prepaint
  332. // stage, then tell Windows we want messages for every item.
  333. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  334. {
  335. *pResult = CDRF_NOTIFYITEMDRAW;
  336. }
  337. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  338. {
  339. // This is the prepaint stage for an item. Here's where we set the
  340. // item's text color. Our return value will tell Windows to draw the
  341. // item itself, but it will use the new color we set here.
  342. // We'll cycle the colors through red, green, and light blue.
  343. CString runtime=m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (5);
  344. CString registertime=m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (6);
  345. if(runtime.IsEmpty ()==0)
  346. {
  347. CString left,right;
  348. int pos=runtime.Find ("能运行:");
  349. if(pos!=-1)
  350. {
  351. left=runtime.Left (pos);
  352. right=runtime.Right (runtime.GetLength ()-pos-7);
  353. left.Replace ("已运行:", "");
  354. left.TrimRight ();
  355. int year,month,day;
  356. pos=left.Find ("年");
  357. year=atoi(left.Left (pos));
  358. left=left.Right (left.GetLength ()-pos-2);
  359. pos=left.Find ("月");
  360. month=atoi(left.Left (pos));
  361. left=left.Right (left.GetLength ()-pos-2);
  362. pos=left.Find ("日");
  363. day=atoi(left.Left (pos));
  364. left=right;
  365. int year2,month2,day2;
  366. pos=left.Find ("年");
  367. year2=atoi(left.Left (pos));
  368. left=left.Right (left.GetLength ()-pos-2);
  369. pos=left.Find ("月");
  370. month2=atoi(left.Left (pos));
  371. left=left.Right (left.GetLength ()-pos-2);
  372. pos=left.Find ("日");
  373. day2=atoi(left.Left (pos));
  374. DWORD tm1=year*365+month*30+day;
  375. DWORD tm2=year2*365+month2*30+day2;
  376. long dt=tm2-tm1;
  377. if(dt<15 || tm1>=tm2)
  378. pLVCD->clrText = RGB(220,0,0);
  379. else
  380. pLVCD->clrText = RGB(20,133,20);
  381. if(registertime.GetLength ()==10)
  382. {
  383. CTime tm(atoi(registertime.Mid (0,4)),atoi(registertime.Mid (5,2)),atoi(registertime.Mid (8,2)),0,0,0);
  384. CTime curtm=CTime::GetCurrentTime ();
  385. CTimeSpan dt=tm-curtm;
  386. if(dt.GetDays ()>10)
  387. pLVCD->clrText = RGB(20,133,20);
  388. else
  389. pLVCD->clrText = RGB(220,0,0);
  390. if(tm<curtm)
  391. pLVCD->clrText = RGB(220,0,0);
  392. }
  393. }
  394. }
  395. // Tell Windows to paint the control itself.
  396. *pResult = CDRF_DODEFAULT;
  397. }
  398. }
  399. void ClientIPFrom2::OnBUTmoney() // 未知客户;
  400. {
  401. // TODO: Add your control notification handler code here
  402. PayOutSet dlg;
  403. dlg.DoModal();
  404. }
  405. void ClientIPFrom2::OnBUTmoney4() // 到期用户;
  406. {
  407. // TODO: Add your control notification handler code here
  408. m_List1.DeleteAllItems2 ();
  409. int ii=0;
  410. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  411. int count=0;
  412. for(ii=0; ii<m_List1array.GetSize (); ii++)
  413. {
  414. CString runtime=m_List1array.ElementAt (ii).ElementAt (5);
  415. CString registertime=m_List1array.ElementAt (ii).ElementAt (6);
  416. BOOL bOK=0;
  417. if(runtime.IsEmpty ()==0)
  418. {
  419. CString left,right;
  420. int pos=runtime.Find ("能运行:");
  421. if(pos!=-1)
  422. {
  423. left=runtime.Left (pos);
  424. right=runtime.Right (runtime.GetLength ()-pos-7);
  425. left.Replace ("已运行:", "");
  426. left.TrimRight ();
  427. int year,month,day;
  428. pos=left.Find ("年");
  429. year=atoi(left.Left (pos));
  430. left=left.Right (left.GetLength ()-pos-2);
  431. pos=left.Find ("月");
  432. month=atoi(left.Left (pos));
  433. left=left.Right (left.GetLength ()-pos-2);
  434. pos=left.Find ("日");
  435. day=atoi(left.Left (pos));
  436. left=right;
  437. int year2,month2,day2;
  438. pos=left.Find ("年");
  439. year2=atoi(left.Left (pos));
  440. left=left.Right (left.GetLength ()-pos-2);
  441. pos=left.Find ("月");
  442. month2=atoi(left.Left (pos));
  443. left=left.Right (left.GetLength ()-pos-2);
  444. pos=left.Find ("日");
  445. day2=atoi(left.Left (pos));
  446. DWORD tm1=year*365+month*30+day;
  447. DWORD tm2=year2*365+month2*30+day2;
  448. long dt=tm2-tm1;
  449. if(dt<15 || tm1>=tm2)
  450. bOK=1;
  451. else
  452. bOK=0;
  453. if(registertime.GetLength ()==10)
  454. {
  455. CTime tm(atoi(registertime.Mid (0,4)),atoi(registertime.Mid (5,2)),atoi(registertime.Mid (8,2)),0,0,0);
  456. CTime curtm=CTime::GetCurrentTime ();
  457. CTimeSpan dt=tm-curtm;
  458. if(dt.GetDays ()>10)
  459. bOK=0;
  460. else
  461. bOK=1;
  462. if(tm<curtm)
  463. bOK=1;
  464. }
  465. }
  466. }
  467. if(bOK)
  468. {
  469. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  470. }
  471. }
  472. m_List1.m_arLabels.SetSize(count, 1);
  473. ii=count;
  474. m_List1.m_LabelCount=ii;
  475. m_List1.SetItemCountEx (ii);
  476. CString str;
  477. str.Format ("域名:%d", ii);
  478. SetDlgItemText(IDC_STATIC2, str);
  479. }
  480. void ClientIPFrom2::OnBUTmoney5() // 运行到期用户;
  481. {
  482. // TODO: Add your control notification handler code here
  483. m_List1.DeleteAllItems2 ();
  484. int ii=0;
  485. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  486. int count=0;
  487. CTime tm=CTime::GetCurrentTime ();
  488. tm-=CTimeSpan(7, 0, 0, 0);
  489. CString strtime1=tm.Format ("%Y-%m-%d");
  490. for(ii=0; ii<m_List1array.GetSize (); ii++)
  491. {
  492. CString refreshtime=m_List1array.ElementAt (ii).ElementAt (4);
  493. if(refreshtime.GetLength ()<10)continue;
  494. if(refreshtime<strtime1)continue;
  495. CString runtime=m_List1array.ElementAt (ii).ElementAt (5);
  496. CString registertime=m_List1array.ElementAt (ii).ElementAt (6);
  497. BOOL bOK=0;
  498. if(runtime.IsEmpty ()==0)
  499. {
  500. CString left,right;
  501. int pos=runtime.Find ("能运行:");
  502. if(pos!=-1)
  503. {
  504. left=runtime.Left (pos);
  505. right=runtime.Right (runtime.GetLength ()-pos-7);
  506. left.Replace ("已运行:", "");
  507. left.TrimRight ();
  508. int year,month,day;
  509. pos=left.Find ("年");
  510. year=atoi(left.Left (pos));
  511. left=left.Right (left.GetLength ()-pos-2);
  512. pos=left.Find ("月");
  513. month=atoi(left.Left (pos));
  514. left=left.Right (left.GetLength ()-pos-2);
  515. pos=left.Find ("日");
  516. day=atoi(left.Left (pos));
  517. left=right;
  518. int year2,month2,day2;
  519. pos=left.Find ("年");
  520. year2=atoi(left.Left (pos));
  521. left=left.Right (left.GetLength ()-pos-2);
  522. pos=left.Find ("月");
  523. month2=atoi(left.Left (pos));
  524. left=left.Right (left.GetLength ()-pos-2);
  525. pos=left.Find ("日");
  526. day2=atoi(left.Left (pos));
  527. DWORD tm1=year*365+month*30+day;
  528. DWORD tm2=year2*365+month2*30+day2;
  529. long dt=tm2-tm1;
  530. if(dt<15 || tm1>=tm2)
  531. bOK=1;
  532. else
  533. bOK=0;
  534. if(registertime.GetLength ()==10)
  535. {
  536. CTime tm(atoi(registertime.Mid (0,4)),atoi(registertime.Mid (5,2)),atoi(registertime.Mid (8,2)),0,0,0);
  537. CTime curtm=CTime::GetCurrentTime ();
  538. CTimeSpan dt=tm-curtm;
  539. if(dt.GetDays ()>10)
  540. bOK=0;
  541. else
  542. bOK=1;
  543. if(tm<curtm)
  544. bOK=1;
  545. }
  546. }
  547. }
  548. if(bOK)
  549. {
  550. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  551. }
  552. }
  553. m_List1.m_arLabels.SetSize(count, 1);
  554. ii=count;
  555. m_List1.m_LabelCount=ii;
  556. m_List1.SetItemCountEx (ii);
  557. CString str;
  558. str.Format ("域名:%d", ii);
  559. SetDlgItemText(IDC_STATIC2, str);
  560. }