Beispiel #1
0
NSDUILIB_API void  TBCIASendMessage(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
	HWND hwnd = (HWND)popint();
	TCHAR msgID[MAX_PATH];
	TCHAR wParam[MAX_PATH];
	TCHAR lParam[MAX_PATH];

	EXDLL_INIT();

 	ZeroMemory(msgID, MAX_PATH*sizeof(TCHAR));
	ZeroMemory(wParam, MAX_PATH*sizeof(TCHAR));
	ZeroMemory(lParam, MAX_PATH*sizeof(TCHAR));

	DEBUG_INFO("to send message stringsize %d MAX_PATH %d\n",g_stringsize,MAX_PATH);
	popstring( msgID,sizeof(msgID) );
	popstring( wParam,sizeof(wParam) );
	popstring( lParam ,sizeof(lParam));

	if( _tcsicmp( msgID, _T("WM_TBCIAMIN")) == 0 )
		::SendMessage( hwnd, WM_TBCIAMIN, (WPARAM)wParam, (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIACLOSE")) == 0 )
		::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIABACK")) == 0 )
		::SendMessage( hwnd, WM_TBCIABACK, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIANEXT")) == 0 )
		::SendMessage( hwnd, WM_TBCIANEXT, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIACANCEL")) == 0 )
	{
		LPCTSTR lpTitle = (LPCTSTR)wParam;
		LPCTSTR lpText = (LPCTSTR)lParam;
		DEBUG_BUFFER_FMT(lpTitle,_tcslen(lpTitle) + sizeof(TCHAR),"lpTitle :");
		DEBUG_BUFFER_FMT(lpText,_tcslen(lpText) + sizeof(TCHAR),"lpText :");
		if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
		{
			pushint( 0 );
			::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
		}
		else
			pushint( -1 );
	}
	else if (_tcsicmp( msgID, _T("WM_QAUERYCANCEL")) == 0)
	{
		LPCTSTR lpTitle = (LPCTSTR)wParam;
		LPCTSTR lpText = (LPCTSTR)lParam;
		if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
		{
			pushint( 0 );
		}
		else
			pushint( -1 );
	}
	else if( _tcsicmp( msgID, _T("WM_TBCIASTARTINSTALL")) == 0 )
	{
		::SendMessage( hwnd, WM_TBCIASTARTINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	}
	else if( _tcsicmp( msgID, _T("WM_TBCIASTARTUNINSTALL")) == 0 )
		::SendMessage( hwnd, WM_TBCIASTARTUNINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIAFINISHEDINSTALL")) == 0 )
		::SendMessage( hwnd, WM_TBCIAFINISHEDINSTALL, (WPARAM)wParam, (LPARAM)lParam );
	else if( _tcsicmp( msgID, _T("WM_TBCIAOPTIONSTATE")) == 0 ) // 返回option的状态
	{
		COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
		if( pOption == NULL )
			return;
		DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
		pushint(  pOption->IsSelected() );
	}
	else if (_tcsicmp( msgID, _T("WM_TBCIASETSTATE")) == 0)
	{
		COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
		if( pOption == NULL )
			return;
		if (_tcsicmp(lParam,_T("1"))== 0)
		{
			pOption->Selected(true);
		}
		else
		{
			pOption->Selected(false);
		}
		DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
		pOption->PaintStatusImage(g_pFrame->GetPaintManager().GetPaintDC());
		pushint(  pOption->IsSelected() );
	}
	else if (_tcsicmp(msgID,_T("WM_TBCIAEXIT"))==0)
	{
		::SendMessage(hwnd,WM_CLOSE,0,0);
	}
	else if( _tcsicmp( msgID, _T("WM_TBCIAOPENURL")) == 0 )
	{
		CDuiString url = (CDuiString)wParam;
		if( url.Find( _T("https://") ) == -1  &&
			url.Find(_T("http://")) == -1)
		{
			pushstring( _T("url error") );
			return;
		}
		CDuiString lpCmdLine = _T("explorer \"");
		lpCmdLine += url;
		lpCmdLine += _T("\"");
		USES_CONVERSION;
		char strCmdLine[MAX_PATH];
#ifdef _UNICODE
		wcstombs(strCmdLine,lpCmdLine.GetData(),MAX_PATH);
#else
		strncpy(strCmdLine,lpCmdLine.GetData(),MAX_PATH);
#endif
		WinExec( strCmdLine, SW_SHOWNORMAL);
	}
}
Beispiel #2
0
void CProjectInfoPage::Notify( TNotifyUI& msg )
{
	if (0 == _tcsicmp(DUI_MSGTYPE_WINDOWINIT, msg.sType))
	{
		HandleWindowInitEvent(msg);
	}

	if (msg.sType != DUI_MSGTYPE_CLICK )
	{
		return;
	}

	DuiLib::CDuiString strName = msg.pSender->GetName();

	//"第一页"
	if (_tcsicmp(strName.GetData(), "btn_page_first") == 0)
	{
		if (!IsCacheEmpty()&& !IsFirstPage())
		{
			GotoPage(1);
		}	
	}
	//"上一页"
	else if (_tcsicmp(strName.GetData(), "btn_page_prev") == 0)
	{
		if (!IsCacheEmpty() && !IsFirstPage())
		{
			if (m_nCurrentPageIndex>1)
			{
				GotoPage(m_nCurrentPageIndex-1);
			}
		}
	}
	//"下一页"
	else if (_tcsicmp(strName.GetData(), "btn_page_next") == 0)
	{
		if (!IsCacheEmpty() && !IsEndPage())
		{
			if (m_nCurrentPageIndex<m_nEndPageIndex)
			{
				GotoPage(m_nCurrentPageIndex+1);
			}
		}
	}
	//"最后一页"
	else if (_tcsicmp(strName.GetData(), "btn_page_end") == 0)
	{
		if (!IsCacheEmpty()&& !IsEndPage())
		{
			if (m_nEndPageIndex>0)
			{
				GotoPage(m_nEndPageIndex);
			}	
		}
	}
	//1--10页按钮
	else if (strName.Find("btn_page_")>=0)
	{
		//tstring strSearch = "btn_page_";
		//tstring strBtnIndex = strName.Right(strName.GetLength()-strSearch.length());
		//int nIndex = atoi(strBtnIndex.c_str());

		int nIndex = atoi(msg.pSender->GetText());
		GotoPage(nIndex);
		return;
	}

	if (_tcsicmp(strName.GetData(), "OptionToday") == 0)
	{
		time_t tToday = time(0);
		FetchProjects(GetYMDTimeString(tToday));
	}
	else if (_tcsicmp(strName.GetData(), "OptionWeek") == 0)
	{
		time_t tToday = time(0);
		time_t tOneWeekAgo = tToday - const_one_week_seconds;
		FetchProjects(GetYMDTimeString(tOneWeekAgo));
	}
	else if (_tcsicmp(strName.GetData(), "OptionMonth") == 0)
	{
		time_t tToday = time(0);
		time_t tOneMonthAgo = tToday - const_one_month_seconds;
		FetchProjects(GetYMDTimeString(tOneMonthAgo));
	}
	else if (_tcsicmp(strName.GetData(), "OptionAll") == 0)
	{
		FetchProjects(tstring(_T("")));
	}
	else if (msg.pSender->GetName() == "btn_get_project_info")
	{
		sProjectItem* pData = (sProjectItem*)msg.pSender->GetParent()->GetParent()->GetParent()->GetTag();
		if (NULL != pData)
		{
			CFrameBusinessData::Instance()->ShowWindow(true);
			CFrameBusinessData::Instance()->setProjectItem(pData);
		}
	}
	else if (msg.pSender->GetName() == "btn_bussiness_chat")
	{
		sProjectItem* pData = (sProjectItem*)msg.pSender->GetParent()->GetParent()->GetParent()->GetTag();
		if (NULL != pData)
		{
			//没有创建房间,就需要重新选人。
			if (pData->strRoomID.empty())
			{
				
				CAddNewGroupMember* pAddGroupMemWnd = new CAddNewGroupMember(m_PaintManager);
				if (NULL != pAddGroupMemWnd)
				{
					pAddGroupMemWnd->SetShowMode(true);
					pAddGroupMemWnd->CreateWnd();
					pAddGroupMemWnd->Initialize();//初始化一次。
				}
				
				//bool bWithProperty = m_pComboResProperty->GetCurSel() == 1;
				pAddGroupMemWnd->SetResProperty(false, pData->strProjID, pData->strProjName);
				pAddGroupMemWnd->ShowWindow(true);
			}
			else
			{
				//我有可能不是这个群里面的成员,就需要判断下。如果我不是这个群里面的人,就不能进去。
				tstring strMyPhone = CController::Instance()->GetXmppClient()->jid().username();
				tstring strMyAccount = strMyPhone+MMPC_ACCOUNT;
				if(CController::Instance()->GetRoomManager()->IsInThisRoom(pData->strRoomID, strMyAccount ))
				{
					CController::Instance()->GetRoomManager()->EnterRoom(pData->strRoomID, strMyPhone);
					if (pData->strDestOrgID.empty() && pData->strDestOrgName.empty())
					{
						if (pData->vecDestParticipants.size()>0)
						{
							mainDlg::getInstance()->OnShowGroupChatWnd_Personal(pData->vecDestParticipants[0], pData->strRoomID);
						}
					}
					else
					{
						mainDlg::getInstance()->OnShowGroupChatWnd(pData->strDestOrgID, pData->strDestOrgName, pData->strRoomID);
					}
				}
				else
				{
					CMsgBox* pMsgBox = new CMsgBox("错误","您不是该群组成员!");
					pMsgBox->ShowModal();
				}
			}
			
		}		
	}	
	//增加搜索功能 by HQ 20160519
	else if (msg.pSender->GetName() == "btn_Search")
	{	
		COptionUI* OptionToday = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionToday"));
		COptionUI* OptionWeek = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionWeek"));
		COptionUI* OptionMonth = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionMonth"));
		COptionUI* OptionAll = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionAll"));

		tstring sSelectedTime=(_T(""));
		if (OptionToday->IsSelected())
		{
			time_t tToday = time(0);
			sSelectedTime = GetYMDTimeString(tToday);
		}
		else if (OptionWeek->IsSelected())
		{
			time_t tToday = time(0);
			time_t tOneWeekAgo = tToday - const_one_week_seconds;
			sSelectedTime = GetYMDTimeString(tOneWeekAgo);
		}
		else if (OptionMonth->IsSelected())
		{
			time_t tToday = time(0);
			time_t tOneMonthAgo = tToday - const_one_month_seconds;
			sSelectedTime = GetYMDTimeString(tOneMonthAgo);
		}
		else if (OptionAll->IsSelected())
		{
			//do nothing...
		}

		CEditUI* edtSearchString = static_cast<CEditUI*>(m_PaintManager->FindControl("edt_SearchString"));
		tstring sSearchString = edtSearchString->GetText();

		//允许空字符串查询 by HQ 20160519
		//if(sSearchString == "")
		//{
		//	CMsgBox* pMsgBox = new CMsgBox("错误","请输入查找条件!");
		//	pMsgBox->ShowModal();
		//	edtSearchString->SetFocus();
		//}
		//else
		//{
			FetchProjects(sSelectedTime,sSearchString);
		//}
	}	
}
bool chat_dialog::RecvMessage(DuiLib::CDuiString name,CDuiString message)
{
	CRichEditUI* pRichEdit=static_cast<CRichEditUI*>(m_PaintManager.FindControl(CHATDLG_RECVEDIT));
	if(pRichEdit==NULL)
	{
		return false;
	}
	CHARFORMAT2 cf;
	memset(&cf,0,sizeof(cf));
	cf.cbSize = sizeof(cf);
	cf.dwReserved = 0;
	cf.dwMask = CFM_COLOR | CFM_LINK | CFM_UNDERLINE | CFM_UNDERLINETYPE;
	cf.dwEffects = CFE_LINK;
	cf.bUnderlineType = CFU_UNDERLINE;
	cf.crTextColor = RGB(220, 0, 0);

	long lSelBegin = 0, lSelEnd = 0;
	lSelEnd = lSelBegin = pRichEdit->GetTextLength();
	pRichEdit->SetSel(lSelEnd, lSelEnd);
	pRichEdit->ReplaceSel(name.GetData(), false);

	lSelEnd = pRichEdit->GetTextLength();
	pRichEdit->SetSel(lSelBegin, lSelEnd);
	pRichEdit->SetSelectionCharFormat(cf);

	TCHAR strTime[MAX_PATH]={0};
	memset(&strTime,0,sizeof(strTime));
	SYSTEMTIME time;
	memset(&time,0,sizeof(time));
	GetLocalTime(&time);
	wsprintf(strTime,_T(": %d-%d-%d %d:%d:%d\n"),time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond);

	lSelEnd = lSelBegin = pRichEdit->GetTextLength();
	pRichEdit->SetSel(lSelEnd, lSelEnd);
	pRichEdit->ReplaceSel(strTime, false);
	cf.dwMask = CFM_COLOR;
	cf.crTextColor = RGB(0, 0, 0);
	cf.dwEffects = 0;
	lSelEnd = pRichEdit->GetTextLength();
	pRichEdit->SetSel(lSelBegin, lSelEnd);
	pRichEdit->SetSelectionCharFormat(cf);

	PARAFORMAT2 pf;
	memset(&pf,0,sizeof(pf));
	pf.cbSize = sizeof(pf);
	pf.dwMask = PFM_STARTINDENT;
	pf.dxStartIndent = 0;
	pRichEdit->SetParaFormat(pf);

	lSelEnd = lSelBegin = pRichEdit->GetTextLength();

	pRichEdit->SetSel(-1, -1);
	pRichEdit->ReplaceSel(message.GetData(), false);

	pRichEdit->SetSel(-1, -1);
	pRichEdit->ReplaceSel(_T("\n"), false);

	cf.crTextColor = RGB(0, 0, 0);
	lSelEnd = pRichEdit->GetTextLength();
	pRichEdit->SetSel(lSelBegin, lSelEnd);
	pRichEdit->SetSelectionCharFormat(cf);

	memset(&pf,0,sizeof(pf));
	pf.cbSize = sizeof(pf);
	pf.dwMask = PFM_STARTINDENT;
	pf.dxStartIndent = 220;
	pRichEdit->SetParaFormat(pf);

	pRichEdit->EndDown();
	return true;
}