123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- // ChoosePhotoSkin.cpp: implementation of the ChoosePhotoSkin class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "ChoosePhotoSkin.h"
- #include "SearchClient.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- extern void WriteTitle(CString str);
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
-
- ChoosePhotoSkin::ChoosePhotoSkin()
- {
- m_mode=0;
- m_exitcode=0;
- m_bsave=0;
- g_pMainWnd->GetSkin();
- }
- ChoosePhotoSkin::~ChoosePhotoSkin()
- {
- }
- void ChoosePhotoSkin::OnFSCommand(LPCTSTR command, LPCTSTR args)
- {
- }
- void ChoosePhotoSkin::Init()
- {
- #ifdef MNLS_VERSION
- if(m_mode==0)
- ((MyBmpButton2*)m_picarray.ElementAt (5))->ShowWindow (SW_HIDE);
- else
- ((MyBmpButton2*)m_picarray.ElementAt (5))->EnableWindow (0);
- #else
- Graphics graph(m_pBk);
- Image *img=NULL;
- if(m_mode==0)
- ::LoadImageFromBuf (&img, g_mainpath+"\\skin\\标题-选片.jpg");
- else
- ::LoadImageFromBuf (&img, g_mainpath+"\\skin\\标题-看设计.jpg");
- graph.DrawImage(img, 0,0);
- delete img;
- ((MyBmpButton2*)m_picarray.ElementAt (5))->ShowWindow (SW_HIDE);
- #endif
-
- m_combobox.Create(WS_VSCROLL|WS_CHILD|CBS_DROPDOWN,m_rcarray.ElementAt (2),this,100);
- m_combobox.ShowWindow(SW_SHOW);
- CRect rc=m_rcarray.ElementAt (2);
- rc.bottom +=200;
- m_combobox.MoveWindow (rc);
- m_combobox.GetWindowRect (rc);
- int hei=rc.Height ();
- rc=m_rcarray.ElementAt (3);
- rc.bottom =rc.top +hei+5;
- m_edit.Create(ES_AUTOHSCROLL|WS_CHILD|ES_LEFT|WS_BORDER|ES_PASSWORD|WS_EX_WINDOWEDGE,rc,this,200);
- m_edit.ShowWindow(SW_SHOW);
- rc=m_rcarray.ElementAt (4);
- rc.bottom =rc.top +13;
- rc.right =rc.left +13;
- m_button.Create("",WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX|BS_FLAT, rc,this,300);
-
-
- tpFont.CreatePointFont (180, _T("黑体"));
- m_edit.SetFont(&tpFont);
- m_combobox.SetFont(&tpFont);
- /////////////////////////
- g_sendhead.bsql=0;
- g_sendhead.code[0]=23;
- g_sendhead.code[1]=24;
- g_sendhead.code[2]=29;
- g_sendhead.code[3]=5;
- g_sendhead.code[4]=1;
- g_sendhead.tabcount=5;
- int g_nYearposTemp=g_nYearpos;
- g_nYearpos=-1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- g_nYearpos=g_nYearposTemp;
- if(g_bSendOK==0)
- {
- CDialog::OnCancel();
- return;
- }
-
- CArray<CStringArray, CStringArray>patharray;
- DataToArray(&m_List1array,&g_cominfoarray,&patharray,&g_userarray,&g_hisyeararray);
- //#ifdef MNLS_VERSION
- if(g_cominfoarray.ElementAt(0).ElementAt(0)!="102")
- {
- AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
- CDialog::OnCancel();
- g_pMainWnd->AutoUpdate();
- return;
- }
- //#endif
- g_title=g_cominfoarray.ElementAt (0).ElementAt (10);
- WriteTitle(g_cominfoarray.ElementAt (0).ElementAt (10));
- g_date=g_cominfoarray.ElementAt(0).ElementAt(1);
- if(g_hisyeararray.GetSize())
- {
- g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
- }
- if(g_server=="127.0.0.1")
- {
- g_sendhead.bsql=0;
- g_sendhead.code[0]=63;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- if(g_bSendOK==0)
- {
- CDialog::OnCancel();
- return;
- }
- DataToArray(&g_List1array);
- g_path1=g_List1array.ElementAt(0).ElementAt(0)+"\\客户原片(管理软件)$";
- g_path2=g_List1array.ElementAt(0).ElementAt(0)+"\\修好的片(管理软件)$";
- g_path3=g_List1array.ElementAt(0).ElementAt(0)+"\\设计好的片(管理软件)$";
- g_path4=g_List1array.ElementAt(0).ElementAt(0)+"\\精修好的片(管理软件)$";
- }
- else if(patharray.GetSize())
- {
- g_path1=patharray.ElementAt(0).ElementAt(0);
- g_path2=patharray.ElementAt(0).ElementAt(1);
- g_path3=patharray.ElementAt(0).ElementAt(2);
- g_path4=patharray.ElementAt(0).ElementAt(3);
- g_path1="\\\\"+g_path1+"\\客户原片(管理软件)$";
- g_path2="\\\\"+g_path2+"\\修好的片(管理软件)$";
- g_path3="\\\\"+g_path3+"\\设计好的片(管理软件)$";
- g_path4="\\\\"+g_path4+"\\精修好的片(管理软件)$";
- }
- try
- {
- CFile fp;
- if(fp.Open (g_mainpath+"\\loginuser.dat", CFile::modeRead))
- {
- DWORD length=fp.GetLength ();
- if(!length)return;
- CArchive ar(&fp, CArchive::load);
- m_userarray.Serialize (ar);
- fp.Close ();
- for(int i=0; i<m_userarray.GetSize (); i++)
- {
- m_combobox.AddString (m_userarray.ElementAt (i));
- }
- if(m_combobox.GetCount ()>0)
- {
- m_combobox.SetCurSel (0);
- m_combobox.GetLBText (0, m_account);
- }
- if(!m_account.IsEmpty ())
- {
- CString version = _T ("Version 1.0");
- m_psw=AfxGetApp()->GetProfileString (version, _T (m_account));
- if(!m_psw.IsEmpty ())
- m_bsave=TRUE;
- }
- // SetDlgItemText(100, m_account);
- SetDlgItemText(200, m_psw);
- m_button.SetCheck (m_bsave);
- }
- }
- catch(...)
- {
- }
- }
- void ChoosePhotoSkin::Destory()
- {
- }
- void ChoosePhotoSkin::BtnClick(WPARAM wParam, LPARAM lParam)
- {
- int id=lParam;
- id-=99;
- switch(id)
- {
- case 1:
- {
- m_combobox.GetWindowText (m_account);
- // GetDlgItemText(100, m_account);
- GetDlgItemText(200, m_psw);
- m_bsave= m_button.GetCheck ();
- if(m_account.IsEmpty())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- for(int i=0; i<m_List1array.GetSize(); i++)
- {
- if(m_account==m_List1array.ElementAt(i).ElementAt(0))
- {
- if(m_psw!=m_List1array.ElementAt(i).ElementAt(2))
- {
- AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION);return;
- }
- else
- {
- g_user.bLongin=1;
- g_user.name=m_List1array.ElementAt(i).ElementAt(1);
- g_user.rights=m_List1array.ElementAt(i).ElementAt(3);
- SaveLongin();
- CString str;
- str="当前用户:"+g_user.name;
-
- SearchClient dlg;
- dlg.m_mode=m_mode;
- dlg.SetLiaPath ("2.lia");
- if(dlg.DoModal ()!=IDOK)
- return;
- m_exitcode=dlg.m_exitcode;
- CDialog::OnOK ();
- return;
- }
- }
- }
- AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
- }
- break;
- case 2:
- CDialog::OnCancel ();
- break;
- }
- }
- BOOL ChoosePhotoSkin::PreTransMsg(MSG* pMsg)
- {
- if(pMsg->message==WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_F2:
- if(m_mode)
- m_exitcode=2;
- CDialog::OnOK ();
- return 1;
- case VK_F3:
- if(m_mode==0)
- m_exitcode=3;
- CDialog::OnOK ();
- return 1;
- case VK_RETURN:
- BtnClick(0, 100);
- return 1;
- }
- }
- else if(pMsg->message==WM_LBUTTONDOWN)
- {
- g_bNeedDrawParent=1;
- CPoint pt;
- ::GetCursorPos (&pt);
- ScreenToClient(&pt);
- CRect rc;
- m_button.GetWindowRect (rc);
- ScreenToClient(rc);
- if(rc.PtInRect (pt))return CDialog::PreTranslateMessage(pMsg);
- if(m_rcarray.ElementAt (4).PtInRect (pt))
- {
- m_button.SetCheck (!m_button.GetCheck ());
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void ChoosePhotoSkin::SaveLongin()
- {
- CString version = _T ("Version 1.0");
- if(m_bsave)
- {
- AfxGetApp()->WriteProfileString (version, _T (m_account), m_psw);
- }
- else
- {
- AfxGetApp()->WriteProfileString (version, _T (m_account), "");
- }
- if(m_userarray.GetSize ())
- {
- if(m_userarray.ElementAt (0)!=m_account)
- {
- RemoveExist(m_account);
- m_userarray.InsertAt (0,m_account);
- if(m_userarray.GetSize ()>30)
- m_userarray.SetSize (30);
- }
- }
- else
- {
- m_userarray.Add (m_account);
- }
- CFile f;
- if(!f.Open (g_mainpath+"\\loginuser.dat", CFile::modeWrite|CFile::modeCreate))return ;
- CArchive ar(&f, CArchive::store);
- m_userarray.Serialize (ar);
- ar.Close();
- f.Close ();
- }
- void ChoosePhotoSkin::RemoveExist(CString str)
- {
- for(int i=0; i<m_userarray.GetSize(); i++)
- {
- if(str==m_userarray.ElementAt(i))
- {
- m_userarray.RemoveAt(i);
- return;
- }
- }
- }
|