BOOL CAppealDlg::PreTranslateMessage(MSG* pMsg) { // TODO: 在此添加专用代码和/或调用基类 CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); if (pMsg->message == WM_USER + 1) { if (pMsg->wParam == 1 || pMsg->wParam == 5) { //wushuqun 2009.5.22 //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!")); return CDialog::PreTranslateMessage(pMsg); } if (m_strInfoFileName == "" || m_strInfoFileWholeName == "") { return CDialog::PreTranslateMessage(pMsg); } if (pMsg->wParam == 4) //当zxh录像文件输送成功后,再传送txt文件 { CStringArray csa; csa.SetSize(0,6); csa.Add(m_strFtpAddress); csa.Add(m_strFtpUserName); csa.Add(m_strFtpPwd); csa.Add(m_strInfoFileName); //远程文件名字 csa.Add(m_strInfoFileWholeName); //本地文件名字 int b=UploadFile(&csa,this->m_hWnd,WM_USER+2); } } else if(pMsg->message == WM_USER + 2) { if (pMsg->wParam == 1 || pMsg->wParam == 5) { //wushuqun 2009.5.22 //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!")); return CDialog::PreTranslateMessage(pMsg); } if (pMsg->wParam == 4) { //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealSuccess","投诉文件已经上传成功!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealSuccess","投诉文件已经上传成功!")); } //删除产生的中间文件 // //删除生成的信息文件 ::DeleteFile(m_strInfoFileWholeName); m_strInfoFileName = ""; m_strInfoFileWholeName = ""; } return CDialog::PreTranslateMessage(pMsg); }
//确定函数 void CManageDlg::OnOK() { //定义数据 MSG_GR_SR_GamePowerSet PowerSet; memset(&PowerSet,0,sizeof(PowerSet)); //效验输入 if (m_dwUserID==0L) return; //效验输入 if (((CButton *)GetDlgItem(IDC_ROOM_TALK))->GetCheck()==BST_CHECKED) CUserPower::SetCanRoomTalk(PowerSet.dwGamePowerID,FALSE); if (((CButton *)GetDlgItem(IDC_GAME_TALK))->GetCheck()==BST_CHECKED) CUserPower::SetCanGameTalk(PowerSet.dwGamePowerID,FALSE); if (((CButton *)GetDlgItem(IDC_SEND_MSG))->GetCheck()==BST_CHECKED) CUserPower::SetCanSendMessage(PowerSet.dwGamePowerID,FALSE); if (((CButton *)GetDlgItem(IDC_WATCH_GAME))->GetCheck()==BST_CHECKED) CUserPower::SetCanWatchGame(PowerSet.dwGamePowerID,FALSE); if (((CButton *)GetDlgItem(IDC_PLAY_GAME))->GetCheck()==BST_CHECKED) CUserPower::SetCanPlayGame(PowerSet.dwGamePowerID,FALSE); //if (((CButton *)GetDlgItem(IDC_IP_PLAY))->GetCheck()==BST_CHECKED) CUserPower::SetCanLimiteIP(PowerSet.dwGamePowerID,FALSE); //效验输入 if (((CButton *)GetDlgItem(IDC_BIND_USER))->GetCheck()==BST_CHECKED) PowerSet.bBindKind|=0x04; if (((CButton *)GetDlgItem(IDC_BIND_GAME))->GetCheck()==BST_CHECKED) PowerSet.bBindKind|=0x02; if (((CButton *)GetDlgItem(IDC_BIND_ROOM))->GetCheck()==BST_CHECKED) PowerSet.bBindKind|=0x01; PowerSet.uLockTime=(UINT)GetDlgItemInt(IDC_TIME); CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); if (PowerSet.uLockTime==0) { //AFCMessageBox(fMsg.GetKeyVal("ManageDlg","LimitTimeErrorRewrite","限制时间错误,请重新填写!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("ManageDlg","LimitTimeErrorRewrite","限制时间错误,请重新填写!")); GetDlgItem(IDC_TIME)->SetFocus(); return; } if (PowerSet.uLockTime>14400) { //AFCMessageBox(fMsg.GetKeyVal("ManageDlg","LimitTenDays","限制时间超过10天,请使用后台管理系统实现您的操作!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("ManageDlg","LimitTenDays","限制时间超过10天,请使用后台管理系统实现您的操作!")); GetDlgItem(IDC_TIME)->SetFocus(); return; } if (PowerSet.bBindKind==0) { //AFCMessageBox(fMsg.GetKeyVal("ManageDlg","SelectBindingType","请选择绑定类型!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("ManageDlg","SelectBindingType","请选择绑定类型!")); return; } //发送数据 PowerSet.bShowActive=FALSE; PowerSet.dwUserID=m_dwUserID; m_pGameInfo->pISocketSend->SendGameData(&PowerSet,sizeof(PowerSet),MDM_GR_MANAGE,ASS_GR_POWER_SET,0); DestroyWindow(); }
void CIMMain::OnNetAddRetrue(NetMessageHead * pNetHead, void * pData) { if (pNetHead->bHandleCode == 1) { //AFCMessageBox("该用户拒绝任何人加其为好友或者用户现在不在线!"); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,"该用户拒绝任何人加其为好友或者用户现在不在线!"); } else if (pNetHead->bHandleCode == 2) { //AFCMessageBox("该用户拒绝任何人加其为好友或者用户现在不在线!");//因为器人不在Z里,会导致加机器人为好友时,提示不在线,所以将提示改成统一zht2012-10-10 DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,"该用户拒绝任何人加其为好友或者用户现在不在线!"); } }
void CPropPannel::OnBnClickedBuy() { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage; //ConfirmDlg confirmDlg("您确定要购买吗?","提示",AFC_YESNO,this); //if (confirmDlg.DoModal() == IDQUXIAO) // return; /*if(AFCMessageBox("您确定要购买吗?","提示",AFC_YESNO) == IDQUXIAO) return;*/ CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; _TAG_PROP_BUY propBuy; propBuy.dwUserID=pWnd->m_PlaceUserInfo.dwUserID; propBuy.nPropID=curPropID; CString stime; stime.Format("%d",CTime::GetCurrentTime()); long curtime=atol(stime); int nPrice=curPropPrice; if(pWnd->m_PlaceUserInfo.iVipTime>curtime) nPrice=curPropVipPrice; if (m_nBuyCount < 0) { strMessage = fMsg.GetKeyVal("PropPanelDlg","ErrorToolNumber","您好,您的输入道具数量不正确,请重新输入!"); //AFCMessageBox(strMessage); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,strMessage); return; } propBuy.iPropPayMoney=nPrice*m_nBuyCount; propBuy.nPropBuyCount=m_nBuyCount; pWnd->SendData(&propBuy,sizeof(_TAG_PROP_BUY),MDM_GP_PROP,ASS_PROP_BUY,0); }
void CPropPannel::OnBnClickedGive() { UpdateData(); if(m_nGiveCount<1) return; CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; //if(_strcmpi(m_sGiveUser,pWnd->m_PlaceUserInfo.nickName)==0) //{ // AFCMessageBox("没有必要将道具送给自己吧!","提示"); // CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; // for(int i = 0; i < MAX_GAME_ROOM; i ++) // { // if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) // { // CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); // CString strMessage = fMsg.GetKeyVal("PropPanelDlg","NotSendToYourself","没有必要将道具送给自己!"); // ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer());// // } // } // return; //} if(_strcmpi(m_sGiveUser,pWnd->m_PlaceUserInfo.nickName)==0) { //AFCMessageBox("没有必要将道具送给自己吧!","提示"); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,"没有必要将道具送给自己吧!"); return; } CString str; str.Format("您确定要送将 %d 个该道具送给玩家 %s 吗?",m_nGiveCount,m_sGiveUser); //if(AFCMessageBox(str,"提示",AFC_YESNO)==IDQUXIAO) if(DUIMessageBox(m_hWnd,MB_YESNO|MB_ICONINFORMATION,"提示",true,str)==IDQUXIAO) return; _TAG_PROP_GIVE propGive; ZeroMemory(&propGive,sizeof(_TAG_PROP_GIVE)); propGive.dwUserID=pWnd->m_PlaceUserInfo.dwUserID; strcpy(propGive.szUser,pWnd->m_PlaceUserInfo.nickName); strcpy(propGive.szTargetUser,m_sGiveUser); propGive.nPropID=curPropID; propGive.nGiveCount=m_nGiveCount; propGive.iPropValue=m_nGiveCount*curPropPrice; pWnd->SendData(&propGive,sizeof(_TAG_PROP_GIVE),MDM_GP_PROP,ASS_PROP_GIVE,0); }
LRESULT CHttpDownloadDlg::OnThreadFinished(WPARAM wParam, LPARAM /*lParam*/) { //It's now safe to close since the thread has signaled us m_bSafeToClose = TRUE; //Stop the animation //m_ctrlAnimate.Stop(); //If an error occured display the message box if (m_bAbort) { this->DestroyWindow(); EndDialog(IDCANCEL); } else if (wParam) { //AFCMessageBox(m_sError); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,m_sError); EndDialog(IDCANCEL); } else { // ShowWindow(SW_NORMAL); ShowWindow(0); memset(&proinfo,0,sizeof(proinfo)); STARTUPINFO stup; memset(&stup , 0, sizeof(stup)); stup.dwFlags=STARTF_USESHOWWINDOW; stup.wShowWindow=SW_SHOWNORMAL; stup.cb=sizeof(stup); ::GetStartupInfo(&stup); if(!::CreateProcess(m_sFileToDownloadInto,NULL,NULL,NULL,false,0 ,NULL,NULL,&stup,&proinfo)) { TCHAR sz[100]; wsprintf(sz,"error:%d",GetLastError()); //AFCMessageBox(sz); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,sz); } m_bFind = false; SetTimer(1,2000,NULL); } return 0L; }
void CGetPoint::OnBnClickedOk() { DWORD point = GetDlgItemInt(IDC_POINT); if(point <= 0 || point > m_SerPoint) { //AFCMessageBox("请正确输入积分值!", "提示"); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,"请正确输入积分值!"); return ; } if(point > 1000000) { //AFCMessageBox("一次最多只能取100万!", "提示"); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,"一次最多只能取100万!"); return ; } //GetParent()-> m_pSend->PostMessage(IDM_GETPOINT,point,m_iInWhere); ShowWindow(false); }
//右击游戏列表` void CIMWnd::OnNMDblclkIMList(NMHDR * pNMHDR, LRESULT * pResult) { try { CPoint p; HTREEITEM hti=m_IMList->GetSelectedItem(); if(hti) { if(m_IMList->GetParentItem(hti)!=0 && m_IMList->GetItemData(m_IMList->GetParentItem(hti))==3) {//如果是黑名单中的 CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); //AFCMessageBox(fMsg.GetKeyVal("IMDlg","NoChatWithBadGuyList","对不起,您不能与黑名单中的用户聊天"),fMsg.GetKeyVal("IMDlg","Tip","提示")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,fMsg.GetKeyVal("IMDlg","Tip","提示"),false,fMsg.GetKeyVal("IMDlg","NoChatWithBadGuyList","对不起,您不能与黑名单中的用户聊天")); } else { int itemDate=m_IMList->GetItemData(hti); if(itemDate>1000) { #ifndef MAINROOM_USE_SHORTMSG int nImg; m_IMList->GetItemImage(hti,nImg,nImg); CIMSession *imSession=m_IMList->openIMSession(itemDate-1000,m_IMList->GetItemText(hti)); if(imSession) { if(nImg==3 || nImg==5) imSession->setUserOnline(true); if(nImg==4 || nImg==6) imSession->setUserOnline(false); imSession->ShowWindow(SW_SHOW); } #else int dwUserid=m_IMList->GetItemData(hti); if(dwUserid<1000) return; dwUserid-=1000; CString sname=m_IMList->GetItemText(hti); m_IMList->openShortMsg(dwUserid,sname.GetBuffer(sname.GetLength())); #endif } } } } catch (...) { TCHAR smsg[1000]={0}; wsprintf(smsg,"IM_TRY_CATCH : [%s]",__FUNCTION__); } *pResult = 0; }
CShortMessage * CIMMain::openShortMsg(long dwUserID, char* pNickName) { CShortMessage * pShortMessageWnd=ActiveShortWnd(dwUserID,pNickName,true); if (pShortMessageWnd==NULL) { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); //AFCMessageBox(fMsg.GetKeyVal("GameRoom","ClosePartWindows","窗口太多,请关闭部分窗口!"));//,MB_ICONQUESTION,this); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("GameRoom","ClosePartWindows","窗口太多,请关闭部分窗口!")); } return pShortMessageWnd; }
void CPropPannel::OnEnChangeBuycount() { CString rString; m_ctlBuyCount.GetWindowText(rString); if(atoi(rString)==0) m_ctlBuyCount.SetWindowText("1"); UpdateData(); CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage; if(m_nBuyCount>255) m_nBuyCount=255; //wushuqun 2009.9.3 //不允许购买负道具 if (m_nBuyCount < 0) { strMessage = fMsg.GetKeyVal("PropPanelDlg","ErrorToolNumber","您好,您的输入道具数量不正确,请重新输入!"); //AFCMessageBox(strMessage); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,strMessage); return; } CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; CString stime; stime.Format("%d",CTime::GetCurrentTime()); long curtime=atol(stime); int nPrice=curPropPrice; if(pWnd->m_PlaceUserInfo.iVipTime>curtime) nPrice=curPropVipPrice; TCHAR szNum[128]; GetNumString(szNum, nPrice*m_nBuyCount, Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); // m_strBuyMoney.Format("(您是%s,需要 %s 金币)",(pWnd->m_PlaceUserInfo.iVipTime>curtime)?"VIP会员":"普通用户",szNum); strMessage = fMsg.GetKeyVal("PropPanelDlg","NeedCoins","(您是%s,需要 %s 金币)"); m_strBuyMoney.Format(strMessage,(pWnd->m_PlaceUserInfo.iVipTime>curtime)? fMsg.GetKeyVal("PropPanelDlg","VIPMember","VIP会员"): fMsg.GetKeyVal("PropPanelDlg","NormalUser","普通用户"),szNum); UpdateData(FALSE); if(nPrice*m_nBuyCount>pWnd->m_PlaceUserInfo.i64Bank) m_bnBuy.EnableWindow(FALSE); else m_bnBuy.EnableWindow(TRUE); }
/* Function :OnNetAddResponse Notes :请求加为好友,对方有了反应 Author :Fred Huang Date :2008-04-7 Parameter :pData-服务器返回的数据 return :void */ void CIMMain::OnNetAddResponse(void * pData) { try { MSG_IM_S_ADDRESPONSE * msg=(MSG_IM_S_ADDRESPONSE*)pData; if(msg->nResponse!=IDYES) { if (msg->dwRefusedUserID == GetMainRoom()->m_PlaceUserInfo.dwUserID) { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); //AFCMessageBox(fMsg.GetKeyVal("IMDlg","RefuseMakeFriend","对不起,对方拒绝您加为好友!"),fMsg.GetKeyVal("IMDlg","Tip","提示")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,fMsg.GetKeyVal("IMDlg","Tip","提示"),false,fMsg.GetKeyVal("IMDlg","RefuseMakeFriend","对不起,对方拒绝您加为好友!")); } return; } HTREEITEM hti=FindUserITEM(msg->dwRequestedUserID); if(!hti) { addUserToList(msg->dwRequestedUserID,msg->sRequestedUserName,1,1,1); if (GetMainRoom()->m_PlaceUserInfo.dwUserID == msg->dwUserID) { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString szMsg; szMsg.Format(fMsg.GetKeyVal("IMDlg","AcceptMakeFriend","玩家[%s]已经添加到你的好友列表中。"), msg->sRequestedUserName); AFCTimerMsgBox(5, szMsg,fMsg.GetKeyVal("IMDlg","Tip","提示")); } else { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString szMsg; szMsg.Format(fMsg.GetKeyVal("IMDlg","AcceptMakeFriend","玩家[%s]已经添加到你的好友列表中。"), msg->sRequirUsrName); AFCTimerMsgBox(5, szMsg,fMsg.GetKeyVal("IMDlg","Tip","提示")); } } } catch (...) { TCHAR smsg[1000]={0}; wsprintf(smsg,"IM_TRY_CATCH : [%s]",__FUNCTION__); } }
void CAppealDlg::OnOK() { // TODO: 在此添加专用代码和/或调用基类 CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); POSITION pos = m_FileListCtrl.GetFirstSelectedItemPosition(); if (pos == NULL) { //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SelectAppealGame","请选择要投诉的游戏")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SelectAppealGame","请选择要投诉的游戏")); return; } int iItem = m_FileListCtrl.GetNextSelectedItem(pos); //m_FileListCtrl if (iItem < 0) { return; } CString strComent = ""; GetDlgItem(IDC_EDIT_APPEAL_CONTENT)->GetWindowText(strComent); if (strComent == "") { //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","AppealReason","请写明要投诉的游戏的原因!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","AppealReason","请写明要投诉的游戏的原因!")); return; } list<RecordFileStruct>::iterator iter = m_fileList.begin(); int iIndex = 0; for (; iter!=m_fileList.end();) { if (iIndex == iItem) { break; } else { iter++; } iIndex++; } RecordFileStruct record = *iter; int iRet = record.strWholeName.Find(record.strFileName); CString szPath = record.strWholeName.Mid(0,iRet); //CString szInfoFile = szPath + m_strUserName + "_"; m_strInfoFileName = m_strUserName + "_"; CString szFileName = record.strFileName.Mid(0,record.strFileName.Find(".")); m_strInfoFileName += szFileName; m_strInfoFileName += ".txt"; m_strInfoFileWholeName = szPath + m_strInfoFileName; CStdioFile file; if (file.Open(m_strInfoFileWholeName,CFile::modeCreate | CFile::modeReadWrite) == false) { //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","AppealError","投诉过程出错,请稍后再试!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","AppealError","投诉过程出错,请稍后再试!")); //wushuqun 2009.5.22 return; } file.SeekToBegin(); file.WriteString(m_strUserName); file.WriteString("\n"); file.WriteString(fMsg.GetKeyVal("AppealDlg","AppealContent","投诉内容:")); file.WriteString("\n"); file.WriteString(strComent); file.WriteString("\n"); GetDlgItem(IDC_EDIT_PHONE_NUM)->GetWindowText(strComent); if (strComent != "") { file.WriteString(fMsg.GetKeyVal("AppealDlg","Telephone","联系电话:")); file.WriteString(strComent); file.WriteString("\n"); } GetDlgItem(IDC_EDIT_APPEAL_EMAIL)->GetWindowText(strComent); if (strComent != "") { file.WriteString(fMsg.GetKeyVal("AppealDlg","Email","Email:")); file.WriteString(strComent); file.WriteString("\n"); } file.Close(); CString strRemotName = m_strUserName + "_" +record.strFileName; CStringArray csa2; csa2.SetSize(0,6); csa2.Add(m_strFtpAddress); csa2.Add(m_strFtpUserName); csa2.Add(m_strFtpPwd); csa2.Add(strRemotName); csa2.Add(record.strWholeName); int b=UploadFile(&csa2,this->m_hWnd,WM_USER+1); //wushuqun 2009.5.22 if (b>0) { //AFCMessageBox(fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!")); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,fMsg.GetKeyVal("AppealDlg","SendAppealError","投诉文件上传失败!")); } CDialog::OnOK(); }
//报告错误 void CHyperLink::ReportError(int iError) { CString strBuffer; switch (iError) { case 0: { strBuffer = "OS out\nof memory or resources."; break; } case SE_ERR_PNF: { strBuffer = "path was not found."; break; } case SE_ERR_FNF: { strBuffer = "file was not found."; break; } case ERROR_BAD_FORMAT: { strBuffer = "The .EXE file error"; break; } case SE_ERR_ACCESSDENIED: { strBuffer = "OS denied\naccess to the specified file."; break; } case SE_ERR_ASSOCINCOMPLETE: { strBuffer = "The filename association is\nincomplete or invalid."; break; } case SE_ERR_DDEBUSY: { strBuffer = "The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."; break; } case SE_ERR_DDEFAIL: { strBuffer = "The DDE transaction failed."; break; } case SE_ERR_DDETIMEOUT: { strBuffer = "The DDE transaction could not\nbe completed because the request timed out."; break; } case SE_ERR_DLLNOTFOUND: { strBuffer = "DLL was not found."; break; } case SE_ERR_NOASSOC: { strBuffer = "There is no application associated\nwith the given filename extension."; break; } case SE_ERR_OOM: { strBuffer = "not enough memory"; break; } case SE_ERR_SHARE: { strBuffer = "A sharing violation occurred. "; break; } default: { strBuffer.Format("Unknown Error (%d) occurred.", iError); break; } } strBuffer=TEXT("Unable to open hyperlink:\n\n")+strBuffer; //AFCMessageBox(strBuffer); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",strBuffer); return; }
void MainFrame::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, kWindowInit) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, kClick) == 0) { if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0 || _tcsicmp(msg.pSender->GetName(), kCancelButtonControlName) == 0) { OnExit(msg); } else if (_tcsicmp(msg.pSender->GetName(), kMinButtonControlName) == 0) { #if defined(UNDER_CE) ::ShowWindow(m_hWnd, SW_MINIMIZE); #else SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), kMaxButtonControlName) == 0) { #if defined(UNDER_CE) ::ShowWindow(m_hWnd, SW_MAXIMIZE); CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName)); if( pControl ) pControl->SetVisible(false); pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName)); if( pControl ) pControl->SetVisible(true); #else SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), kRestoreButtonControlName) == 0) { #if defined(UNDER_CE) ::ShowWindow(m_hWnd, SW_RESTORE); CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName)); if( pControl ) pControl->SetVisible(true); pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName)); if( pControl ) pControl->SetVisible(false); #else SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), _T("select_all_btn")) == 0) { CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list"))); for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i) { COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option"))); if (pDriver != NULL) pDriver->Selected(true); } } else if (_tcsicmp(msg.pSender->GetName(), _T("uninstall_btn")) == 0) { vector<tString> deleted_printer_driver; DWORD dwError = 0; TCHAR szBuf[MAX_PATH] = {0}; CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list"))); for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i) { COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option"))); if ((pDriver != NULL) && pDriver->IsSelected()) { // 涉及到的API: DeletePrinter DeletePrinterDriver HANDLE hPrinter = NULL; _stprintf_s(szBuf, MAX_PATH - 1, pDriver->GetText().GetData()); PRINTER_DEFAULTS PrtDefault = {NULL, NULL, PRINTER_ALL_ACCESS}; OpenPrinter(szBuf, &hPrinter, &PrtDefault); if (hPrinter != NULL) { DWORD dwNeeded = 0; GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded); LPBYTE lpBuffer = (LPBYTE)malloc(dwNeeded); if (lpBuffer != NULL) { GetPrinter(hPrinter, 2, lpBuffer, dwNeeded, &dwNeeded); DeletePrinter(hPrinter); dwError = GetLastError(); vector<tString>::const_iterator citer = find(deleted_printer_driver.begin(), deleted_printer_driver.end(), ((PRINTER_INFO_2*)lpBuffer)->pDriverName); if (citer == deleted_printer_driver.end()) { deleted_printer_driver.push_back(((PRINTER_INFO_2*)lpBuffer)->pDriverName); } ClosePrinter(hPrinter); free(lpBuffer); } } } } for (vector<tString>::const_iterator citer = deleted_printer_driver.begin(); citer != deleted_printer_driver.end(); ++citer) { _stprintf_s(szBuf, MAX_PATH - 1, citer->c_str()); DeletePrinterDriver(NULL, NULL, szBuf); dwError = GetLastError(); } RestartSpoolsv(); EnumInstalledDriver(); if (IDYES == DUIMessageBox(m_hWnd, _T("注意:您需要重新启动计算机使设置生效,现在需要重启计算机吗?点击“是”立即重启计算机,点击“否”稍后您自己手动重启计算机。"), _T("重新启动计算机"), MB_YESNO)) SystemReboot(); } } else if (_tcsicmp(msg.sType, kTimer) == 0) { return OnTimer(msg); } }
//右击IM列表` void CIMWnd::OnNMRclickIMList(NMHDR * pNMHDR, LRESULT * pResult) { try { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CPoint point; GetCursorPos(&point); m_IMList->ScreenToClient(&point); HTREEITEM hti=m_IMList->HitTest(point); if(!hti) return; int dwUserid=m_IMList->GetItemData(hti); if(dwUserid<1000) return; dwUserid-=1000; CString sname=m_IMList->GetItemText(hti); CMenu menu; menu.CreatePopupMenu(); MENUINFO mi; menu.GetMenuInfo(&mi); mi.cbSize=sizeof(MENUINFO); mi.fMask=MIM_BACKGROUND; mi.hbrBack = CreateSolidBrush(RGB(0xD1,0xF1,0xFF)); menu.SetMenuInfo(&mi); if((m_IMList->GetParentItem(hti)==m_IMList->htiFamilier) ||(m_IMList->GetParentItem(hti)==m_IMList->htiUnfamilier)) { menu.AppendMenu(MF_STRING,10,fMsg.GetKeyVal("IMDlg","Chat","聊天")); } menu.AppendMenu(MF_STRING,11,fMsg.GetKeyVal("IMDlg","Delete","删除")); if(m_IMList->GetParentItem(hti)!=m_IMList->htiFamilier) { menu.AppendMenu(MF_STRING,21,fMsg.GetKeyVal("IMDlg","ToFriend","加入好友")); } if(m_IMList->GetParentItem(hti)!=m_IMList->htiBlack) { menu.AppendMenu(MF_STRING,22,fMsg.GetKeyVal("IMDlg","ToBadGuyList","加入黑名单")); } CPoint p; ::GetCursorPos(&p); int ret=menu.TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RETURNCMD,p.x,p.y,this); switch(ret) { case 10: { #ifndef MAINROOM_USE_SHORTMSG int nImg; m_IMList->GetItemImage(hti,nImg,nImg); CIMSession *imSession=m_IMList->openIMSession(dwUserid,sname);// if(imSession) { if(nImg==3 || nImg==5) imSession->setUserOnline(true); if(nImg==4 || nImg==6) imSession->setUserOnline(false); imSession->ShowWindow(SW_SHOW); } #else m_IMList->openShortMsg(dwUserid,sname.GetBuffer(sname.GetLength())); #endif } break; case 11: { //if(AFCMessageBox(fMsg.GetKeyVal("IMDlg","R_U_SureDelFriend","您确定要删除该好友吗?"), // fMsg.GetKeyVal("IMDlg","Tip","提示"),AFC_YESNO)==IDOK) if(DUIMessageBox(m_hWnd,MB_YESNO|MB_ICONINFORMATION,fMsg.GetKeyVal("IMDlg","Tip","提示"),true,fMsg.GetKeyVal("IMDlg","R_U_SureDelFriend","您确定要删除该好友吗?"))==IDOK) m_IMList->SetUserGroup(dwUserid,NULL,0); } break; case 21: m_IMList->SetUser(dwUserid,"",true); break; case 22: { //if(AFCMessageBox(fMsg.GetKeyVal("IMDlg","MoveFriendToBadList","您确定要将该好友放到黑名单吗?"), // fMsg.GetKeyVal("IMDlg","Tip","提示"),AFC_YESNO)==IDOK) if(DUIMessageBox(m_hWnd,MB_YESNO|MB_ICONINFORMATION,fMsg.GetKeyVal("IMDlg","Tip","提示"),true,fMsg.GetKeyVal("IMDlg","MoveFriendToBadList","您确定要将该好友放到黑名单吗?"))==IDYES) { m_IMList->SetUserGroup(dwUserid,NULL,3); CString szMsg; szMsg.Format(fMsg.GetKeyVal("IMDlg","MoveOneToBadList","玩家[%s]已经加入到你的黑名单中"), sname); AFCTimerMsgBox(5, szMsg); } } break; } DeleteObject(mi.hbrBack); } catch (...) { TCHAR smsg[1000]={0}; wsprintf(smsg,"IM_TRY_CATCH : [%s]",__FUNCTION__); } *pResult = 0; }
BOOL CHttpDownloadDlg::OnInitDialog() { //Let the parent class do its thing CDialog::OnInitDialog(); m_bgImage.LoadFromResource(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2)); if(!m_bgImage.IsNull()) { MoveWindow(0,0,m_bgImage.GetWidth(),m_bgImage.GetHeight()); CenterWindow(); } //Setup the animation control //m_ctrlAnimate.Open(IDR_HTTPDOWNLOAD_ANIMATION); m_ctrlAnimate.ShowWindow(SW_HIDE); m_static.SetMyText("游戏下载"); m_static.MoveWindow(10,40,80,80); m_listbox.MoveWindow(12,58,410,100); m_listbox.InitListCtrl(RGB(194,212,234),RGB(0,0,0),RGB(249,175,40),RGB(0,0,0),""); m_listbox.setProcessPos(2); m_listbox.SetProcessImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP6),MAKEINTRESOURCE(IDB_BITMAP7)); m_listbox.InsertColumn(0,"文件名",LVCFMT_CENTER,130); m_listbox.InsertColumn(1,"大小(KB)",LVCFMT_CENTER,60); m_listbox.InsertColumn(2,"进度",LVCFMT_CENTER,170); m_listbox.InsertColumn(3,"速度",LVCFMT_CENTER,50); m_listbox.InitListHeader(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1),MAKEINTRESOURCE(IDB_BITMAP1),RGB(255,255,255),RGB(255,255,255),1); m_listbox.SetTimer(100,10,NULL); m_exit.LoadImageFromeResource(AfxGetInstanceHandle(),IDB_BITMAP5); m_exit.SetPosition(CPoint(410,10)); m_cancel.LoadImageFromeResource(AfxGetInstanceHandle(),IDB_BITMAP4); m_cancel.SetPosition(CPoint(360,175)); //Validate the URL ASSERT(m_sURLToDownload.GetLength()); //Did you forget to specify the file to download if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort)) { //Try sticking "http://" before it m_sURLToDownload = CString("http://") + m_sURLToDownload; if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort)) { TRACE(_T("Failed to parse the URL: %s\n"), m_sURLToDownload); EndDialog(IDCANCEL); return TRUE; } } //Check to see if the file we are downloading to exists and if //it does, then ask the user if they were it overwritten CFileStatus fs; ASSERT(m_sFileToDownloadInto.GetLength()); if (CFile::GetStatus(m_sFileToDownloadInto, fs)) {/* CString sMsg; AfxFormatString1(sMsg, IDS_HTTPDOWNLOAD_OK_TO_OVERWRITE, m_sFileToDownloadInto); if (AfxMessageBox(sMsg, MB_YESNO) != IDYES) { TRACE(_T("Failed to confirm file overwrite, download aborted\n")); EndDialog(IDCANCEL); return TRUE; }*/ } //Try and open the file we will download into if (!m_FileToWrite.Open(m_sFileToDownloadInto, CFile::modeCreate | CFile::modeWrite | CFile::shareDenyWrite)) { TRACE(_T("Failed to open the file to download into, Error:%d\n"), GetLastError()); CString sError; sError.Format(_T("%d"), ::GetLastError()); CString sMsg; AfxFormatString1(sMsg, IDS_HTTPDOWNLOAD_FAIL_FILE_OPEN, sError); //AFCMessageBox(sMsg); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,sMsg); EndDialog(IDCANCEL); return TRUE; } //Pull out just the filename component int nSlash = m_sObject.ReverseFind(_T('/')); if (nSlash == -1) nSlash = m_sObject.ReverseFind(_T('\\')); if (nSlash != -1 && m_sObject.GetLength() > 1) m_sFilename = m_sObject.Right(m_sObject.GetLength() - nSlash - 1); else m_sFilename = m_sObject; m_listbox.InsertItem(0,m_sFilename.GetBuffer()); //Set the file status text CString sFileStatus; ASSERT(m_sObject.GetLength()); ASSERT(m_sServer.GetLength()); AfxFormatString2(sFileStatus, IDS_HTTPDOWNLOAD_FILESTATUS, m_sFilename, m_sServer); m_ctrlFileStatus.SetWindowText(sFileStatus); //Spin off the background thread which will do the actual downloading m_pThread = AfxBeginThread(_DownloadThread, this, THREAD_PRIORITY_NORMAL, CREATE_SUSPENDED); if (m_pThread == NULL) { TRACE(_T("Failed to create download thread, dialog is aborting\n")); EndDialog(IDCANCEL); return TRUE; } m_pThread->m_bAutoDelete = FALSE; m_pThread->ResumeThread(); return TRUE; }