ClientIPForm.cpp 16 KB

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