// ChoosePhotoSkin.cpp: implementation of the ChoosePhotoSkin class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "YLGL.h" #include "ChoosePhotoSkin.h" #include "SearchClient.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // 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() { g_bInSkin = 1; if (1)//g_bRedSkin) { Graphics graph(m_pBk); Image *img = NULL; if (m_mode == 0) ::LoadImageFromBuf(&img, g_mainpath + "\\ͼƬ\\ѡƬ.jpg"); else ::LoadImageFromBuf(&img, g_mainpath + "\\ͼƬ\\¿´Éè¼Æ.jpg"); graph.SetSmoothingMode(SmoothingModeHighQuality); graph.DrawImage(img, 0, 0); delete img; ((MyBmpButton2*)m_picarray.ElementAt(5))->EnableWindow(0); ((MyBmpButton2*)m_picarray.ElementAt(6))->EnableWindow(0); ((MyBmpButton2*)m_picarray.ElementAt(7))->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.SetSmoothingMode(SmoothingModeHighQuality); graph.DrawImage(img, 0, 0); delete img; ((MyBmpButton2*)m_picarray.ElementAt(5))->ShowWindow(SW_HIDE); } 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); ///////////////////////// #if JEFF_TEST_ON g_sendhead.bsql = 0; g_sendhead.code[0] = 24; g_sendhead.code[1] = 29; g_sendhead.code[2] = 5; g_sendhead.code[3] = 1; if (g_branchname == "") { g_sendhead.code[4] = 152; g_sendhead.tabcount = 5; } else g_sendhead.tabcount = 4; int g_nYearposTemp = g_nYearpos; g_nYearpos = -1; g_pMainWnd->ProcessChatMessageRequest2(";;;;;"); g_nYearpos = g_nYearposTemp; if (g_bSendOK == 0) { CDialog::OnCancel(); return; } CArraypatharray; CArrayuserarray; if (g_branchname == "") DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_brancharray); else DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray); #else 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; if (g_branchname == "") { g_sendhead.code[5] = 152; g_sendhead.tabcount = 6; } else g_sendhead.tabcount = 5; int g_nYearposTemp = g_nYearpos; g_nYearpos = -1; g_pMainWnd->ProcessChatMessageRequest2("[dimission]<>'ÀëÖ°' or [dimission] is null;;;;;;"); g_nYearpos = g_nYearposTemp; if (g_bSendOK == 0) { CDialog::OnCancel(); return; } CArraypatharray; CArrayuserarray; if (g_branchname == "") DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_brancharray); else DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray); #endif if (g_branchname == "") { g_cominfoarraylocal.SetSize(1, 1); g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0)); } if (g_branchname == "") { g_domain = patharray.ElementAt(0).ElementAt(0); if (g_domain.Find(".ly.com") == -1)g_domain.Empty(); g_bSaveUploadTask1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(67)); g_bSaveUploadTask2 = atoi(g_cominfoarray.ElementAt(0).ElementAt(68)); g_bSaveUploadTask3 = atoi(g_cominfoarray.ElementAt(0).ElementAt(69)); g_bSaveUploadTask4 = atoi(g_cominfoarray.ElementAt(0).ElementAt(70)); } BOOL bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(58)); AfxGetApp()->WriteProfileInt(LYFZVERSION, "hidewindow2", bHide); g_userarray.SetSize(userarray.GetSize(), 1); int count = 0; for (int ii = 0; ii < userarray.GetSize(); ii++) { if (userarray.ElementAt(ii).ElementAt(10) == "ÔÚÖ°") g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii)); } g_userarray.SetSize(count, 1); // ÉèÖð汾ºÅ; CString strVersion; strVersion.Format("%02d%02d", g_arrFileVersion[2], g_arrFileVersion[3]); if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion) { AfxMessageBox("Äú±ØÐë¸üÐÂÈí¼þ²ÅÄܼÌÐøÊ¹ÓÃ, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONINFORMATION); CDialog::OnCancel(); g_pMainWnd->AutoUpdate(); return; } #ifndef ENTERPRISE_VERSION { #ifndef CHILD_VERSION #ifdef BASIC_VERSION if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #else if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #endif #else #ifdef BASIC_VERSION if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #else if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #endif #endif } #else { #ifndef CHILD_VERSION #ifdef BASIC_VERSION if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #else if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #endif #else #ifdef BASIC_VERSION if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0);return; } #else if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7") { AfxMessageBox("Èí¼þ¿Í»§¶ËÓë·þÎñÆ÷°æ±¾²»Æ¥Åä, ÇëÓëϵͳ¹ÜÀíÔ±ÁªÏµ!", MB_ICONSTOP); exit(0); return; } #endif #endif } #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_brancharray.GetSize() && g_branchname == "") { g_pMainWnd->AddBranchMenu(&g_brancharray); } if (g_branchname == "") { 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) + "\\¾«ÐÞºÃµÄÆ¬(¹ÜÀíÈí¼þ)$"; g_path5 = g_List1array.ElementAt(0).ElementAt(0) + "\\Àñ·þͼƬ(¹ÜÀíÈí¼þ)$"; g_path6 = g_List1array.ElementAt(0).ElementAt(0) + "\\µç»°Â¼Òô(¹ÜÀíÈí¼þ)$"; g_path7 = g_path1 + "\\Ч¹ûͼ"; } else if (patharray.GetSize()) { g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = g_serverbak; g_path1 = "\\\\" + g_path1 + "\\¿Í»§Ô­Æ¬(¹ÜÀíÈí¼þ)$"; g_path2 = "\\\\" + g_path2 + "\\ÐÞºÃµÄÆ¬(¹ÜÀíÈí¼þ)$"; g_path3 = "\\\\" + g_path3 + "\\Éè¼ÆºÃµÄƬ(¹ÜÀíÈí¼þ)$"; g_path4 = "\\\\" + g_path4 + "\\¾«ÐÞºÃµÄÆ¬(¹ÜÀíÈí¼þ)$"; g_path5 = "\\\\" + g_path5 + "\\Àñ·þͼƬ(¹ÜÀíÈí¼þ)$"; g_path6 = "\\\\" + g_path6 + "\\µç»°Â¼Òô(¹ÜÀíÈí¼þ)$"; g_path7 = g_path1 + "\\Ч¹ûͼ"; } g_path1bak = g_path1; g_path2bak = g_path2; g_path3bak = g_path3; g_path4bak = g_path4; g_path5bak = g_path5; g_path6bak = g_path6; g_path7bak = g_path7; } 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()) { m_psw = AfxGetApp()->GetProfileString(LYFZVERSION, _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: { #if JEFF_TEST_ON 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; } CString strSQL; BYTE byPsw[50] = {0}; #ifndef UNICODE memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength()); #endif CMD5 md5; md5.SetBYTEText(byPsw, strlen((char*)byPsw)); strSQL.Format(_T("account='%s' and psw='%s'"), m_account, md5.GetMD5Digest()); g_sendhead.bsql = 0; g_sendhead.code[0] = 23; g_sendhead.tabcount = 1; g_pMainWnd->ProcessChatMessageRequest2(strSQL); //CArray arryOfAccountInfo; if (!g_bSendOK) { MessageBox(_T("Ìáʾ"),_T("Á¬½Ó·þÎñÆ÷ʧ°Ü"),MB_OK | MB_TOPMOST); } m_List1array.RemoveAll(); DataToArray(&m_List1array); if (m_List1array.GetSize() == 0) { //AfxMessageBox("Õ˺ŻòÃÜÂë´íÎó"); MessageBox(_T("Ìáʾ"),_T("Õ˺ŻòÃÜÂë´íÎó"),MB_OK | MB_TOPMOST); return; } else { g_user.bLongin = 1; g_user.account = m_account; g_user.name = m_List1array.ElementAt(0).ElementAt(1); g_user.rights = m_List1array.ElementAt(0).ElementAt(3); g_user.rights2 = m_List1array.ElementAt(0).ElementAt(4); g_user.m_discount = m_List1array.ElementAt(0).ElementAt(5); g_user.m_discount2 = m_List1array.ElementAt(0).ElementAt(6); g_user.level = m_List1array.ElementAt(0).ElementAt(7); SaveLongin(); g_pMainWnd2->RefreshOutlookBar(); CString str; str = "µ±Ç°Óû§:" + g_user.name; #ifndef NEW_SKIN g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE); #endif SearchClient dlg; dlg.m_mode = m_mode; dlg.SetLiaPath("2.lia"); if (dlg.DoModal() != IDOK) return; m_exitcode = dlg.m_exitcode; CDialog::OnOK(); return; } #else 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.account = m_account; g_user.name = m_List1array.ElementAt(i).ElementAt(1); g_user.rights = m_List1array.ElementAt(i).ElementAt(3); g_user.rights2 = m_List1array.ElementAt(i).ElementAt(4); g_user.m_discount = m_List1array.ElementAt(i).ElementAt(5); g_user.m_discount2 = m_List1array.ElementAt(i).ElementAt(6); g_user.level = m_List1array.ElementAt(i).ElementAt(7); // g_user.bm=GetBm(g_user.name,g_userarray); SaveLongin(); g_pMainWnd2->RefreshOutlookBar(); CString str; str = "µ±Ç°Óû§:" + g_user.name; #ifndef NEW_SKIN g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE); #endif 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); #endif } break; case 2: CDialog::OnCancel(); break; } } BOOL ChoosePhotoSkin::PreTransMsg(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN) { switch (pMsg->wParam) { case VK_F2: if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1; if (m_mode) m_exitcode = 2; CDialog::OnOK(); return 1; case VK_F3: if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1; 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() { if (m_bsave) { AfxGetApp()->WriteProfileString(LYFZVERSION, _T(m_account), m_psw); } else { AfxGetApp()->WriteProfileString(LYFZVERSION, _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; } } }