// 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; } CArraypatharray; 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; i0) { 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; imessage==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