www.pudn.com > T9Module_OK.rar > T9ModuleDlg.cpp


// T9ModuleDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "T9Module.h" 
#include "T9ModuleDlg.h" 
#include "Index.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CT9ModuleDlg dialog 
 
CString strright;//光标移出编辑框时光标右边的字符串 
CString strleft; //光标移出编辑框时光标左边的字符串 
CT9ModuleDlg::CT9ModuleDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CT9ModuleDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CT9ModuleDlg) 
	m_edit1 = _T(""); 
	m_edit2 = _T(""); 
	//}}AFX_DATA_INIT 
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 
 
	/*-------------------------------------------------------*/ 
	m_nTimes=0;	 
	Times=0;   
		 //ZiMuString= L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
		//ZiMuString.Format(L"%s","abcdefghijklmnopqrstuvwxyz"); 
         ZiMuString="abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ";  
		 //BiaoDianString=L"%s,.+-*/\@?><-!#${}[]"; 
		 //BiaoDianString=",。.?!:;、()-+=#《》【】|{}$~@&‘’“”"; 
		 BiaoDianString=",。?!:;、“”";//2006.6.13 
		 NumberArray.RemoveAll(); 
	/*-------------------------------------------------------*/ 
 
} 
 
void CT9ModuleDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CT9ModuleDlg) 
	DDX_Control(pDX, IDC_RESULTEDIT, m_MyEdit); 
	DDX_Control(pDX, IDC_SELECTEDWORD_EDIT, m_edtSelectedWord); 
	DDX_Text(pDX, IDC_EDIT1, m_edit1); 
	DDX_Text(pDX, IDC_EDIT3, m_edit2); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CT9ModuleDlg, CDialog) 
	//{{AFX_MSG_MAP(CT9ModuleDlg) 
	ON_WM_TIMER() 
	ON_EN_KILLFOCUS(IDC_SELECTEDWORD_EDIT, OnKillfocusSelectedwordEdit) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CT9ModuleDlg message handlers 
 
BOOL CT9ModuleDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// Set the icon for this dialog.  The framework does this automatically 
	//  when the application's main window is not a dialog 
	SetIcon(m_hIcon, TRUE);			// Set big icon 
	SetIcon(m_hIcon, FALSE);		// Set small icon 
	 
	CenterWindow(GetDesktopWindow());	// center to the hpc screen 
	// TODO: Add extra initialization here 
	SetTimer(1,1000,NULL); 
	IsKeyDown=FALSE; 
/*------------------------------------------------------------------*/ 
		FILE * pfDictionay; 
	char string[2000]; 
	TCHAR string1[2000]; 
	TCHAR string2[2000]; 
 
	pfDictionay=fopen("\\ResidentFlash\\输入法编码.txt","rb");//将输入法映射表[拼音-汉字]从文件中读出 
	/*if(pfDictionay != NULL) 
	{ 
		MessageBox(L"file is  opened!"); 
	}*/ 
 
	CString strPingYin,strHanZi; 
	DICTIONARY tempDictionary;	//结构	 
	CString str; 
		while(!feof(pfDictionay)) 
	{	 
	 
		fscanf(pfDictionay,"%s",string); 
		int n1 = CharToUnicode(string1,string,2000,CP_ACP); 
		tempDictionary.PingYin=CString(string); 
 
		fscanf(pfDictionay,"%s",string); 
		int n2 = CharToUnicode(string2,string,2000,CP_ACP); 
		tempDictionary.HanZi=CString(string); 
		 
		DictionaryArray.Add(tempDictionary); 
	} 
 
 
	CString TempString; 
	int Number; 
	for(int i=0;imessage == WM_KEYDOWN) 
	{	 
	switch(pMsg->wParam) 
	{ 
	 
 
	case '1': 
		{ 
	if(!m_bIsPinYin)							//!m_bIsPinYin = TRUE 
	{ 
         break; 
	} 
	else 
	{ 
		if(!m_bIsShuZi)									//是数字			 
		{ 
			CString m_LastWord1; 
			m_LastWord1 = L"1"; 
			 if ((strleft=="")&&(strright=="")) 
			 { 
				m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
			    m_SelectedWord = m_SelectedWord + m_LastWord1; 
			 } 
			 else  
			 { 
                m_SelectedWord=strleft+m_LastWord1+strright; 
				//strleft=""; 
				//strright=""; 
			 } 
			m_edtSelectedWord.SetWindowText(m_SelectedWord);	//是数字,则再加1显示			 
			  
			//添加一个数字,将光标移到该数字之后 
			/////by chen 2006.6.21 
			//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
			//m_edtSelectedWord.SetSel(nLenth,nLenth); 
			//m_edtSelectedWord.SetFocus(); 
			break; 
		}		 
		else//是选汉字 
		{ 
			 
			if (m_bIsZiMu||m_bIsBiaoDian) 
			{ 
		     CString m_LastWord,str; 
			 m_MyEdit.SetFocus(); 
			 UpdateData(TRUE); 
			 m_MyEdit.GetWindowText(str); 
			 UpdateData(FALSE); 
			 if (str.GetLength()>0) 
			 { 
			 m_LastWord = str.Mid(0,1);		//取第1个汉字 
			 
			//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
			//UpdateData(); 
			//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
			 //UpdateData(TRUE); 
            if ((strleft=="")&&(strright=="")) 
			 { 
				m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
			    m_SelectedWord = m_SelectedWord + m_LastWord; 
			 } 
			 else  
			 { 
                m_SelectedWord=strleft+m_LastWord+strright; 
				//strleft=""; 
				//strright=""; 
			 } 
			 m_edtSelectedWord.SetWindowText(m_SelectedWord); 
			 UpdateData(FALSE); 
			//添加一个汉字,设置光标到该汉字之后 
			 /////by chen 2006.6.21 
			//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
			//m_edtSelectedWord.SetSel(nLenth,nLenth); 
			//m_edtSelectedWord.SetFocus(); 
			break; 
			 } 
			 else 
				 break; 
			} 
			if (m_nClickTimes==1) 
			{ 
			CString m_LastWord; 
			m_MyEdit.SetFocus(); 
			m_LastWord = m_strCurrentString.Mid(0,1);		//取第1个汉字			 
			//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
			//UpdateData(); 
			//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
		    if ((strleft=="")&&(strright=="")) 
			 { 
				m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
			    m_SelectedWord = m_SelectedWord + m_LastWord; 
			 } 
			 else  
			 { 
                m_SelectedWord=strleft+m_LastWord+strright; 
				strleft=""; 
				strright=""; 
			 } 
			m_edtSelectedWord.SetWindowText(m_SelectedWord); 
			////////////////////////////////////////////////////////// 
			for(int i=0;i<1500;i++) 
			{ 
				if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
				{ 
					nStartPinYin=2; 
					nEndPinYin=3; 
					m_MyEdit.SetFocus(); 
					m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
					//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
					m_strCurrentString=(CString)Lx_Index[i].HZ; 
					m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
					break; 
				} 
			} 
			////////////////////////////////////////////////////////// 
			//添加一个汉字,设置光标到该汉字之后 
			//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
			//m_edtSelectedWord.SetSel(nLenth,nLenth); 
			//m_edtSelectedWord.SetFocus(); 
			break; 
			} 
		} 
	} 
			break; 
		} 
		case '2': 
	 
			{ 
				if(!m_bIsPinYin)							//!m_bIsPinYin = TRUE 
				{ 
					if(Times==6)   
					   return 1; 
					 
					 
					Times=Times+1;							//第一次Times = 1 
					 
					 
					CString TempString1;			 
					CString TempString2; 
					CString TempString3; 
					 
					if(Times==1) 
					{ 
						 
						AllResult[1].Add("a");				//所有的可能的结果"a","b","c" 
						AllResult[1].Add("b"); 
						AllResult[1].Add("c"); 
						 
						Result[1].Add("a");									//结果显示"a" 
					} 
					else 
					{ 
						 
						for(int i=0;i1) 
							{ 
								m_LastWord = str.Mid(1,1);		//取第1个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m//_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								//if ((strleft!="")&&(strright!="")) 
								//{ 
									m_SelectedWord=strleft+m_LastWord+strright; 
									 
							//	} 
							//	else  
								//{ 
								//	m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
								//	m_SelectedWord = m_SelectedWord + m_LastWord; 
									//strleft=""; 
									//strright=""; 
								//} 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
						////////////////////////////////// 
						 
						if(!m_bIsShuZi)		//是数字			 
						{ 
							CString m_LastWord1; 
							m_LastWord1 = L"2"; 
							//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
							//m_SelectedWord = m_SelectedWord + m_LastWord1; 
							if ((!wcscmp(strleft,L""))&&(!wcscmp(strright,L""))) 
							{ 
								m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
								m_SelectedWord = m_SelectedWord + m_LastWord1; 
							} 
							else  
							{ 
								m_SelectedWord=strleft+m_LastWord1+strright; 
								//strleft=""; 
								//strright=""; 
							} 
							m_edtSelectedWord.SetWindowText(m_SelectedWord);	//是数字,则再加1显示 
							 
							//添加一个汉字,设置光标到该汉字之后 
							/////by chen 2006.6.21 
						//	int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
						//	m_edtSelectedWord.SetSel(nLenth,nLenth); 
						//	m_edtSelectedWord.SetFocus(); 
							 
						} 
						else if (m_nClickTimes==1)		  //不是数字 
						{ 
							CString m_LastWord; 
							m_LastWord = m_strCurrentString.Mid(1,1);		//取第2个汉字 
							//m_MyEdit.SetFocus(); 
							//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
							//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
							//if ((!wcscmp(strleft,L""))&&(!wcscmp(strright,L""))) 
							//{ 
							//	m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
							//	m_SelectedWord = m_SelectedWord + m_LastWord; 
								//AfxMessageBox(L"test"); 
							//} 
							//else  
						//	{ 
								m_SelectedWord=strleft+m_LastWord+strright; 
								//strleft=""; 
								//strright=""; 
						//	} 
							m_edtSelectedWord.SetWindowText(m_SelectedWord); 
 
							m_edit1=strleft; 
	                        m_edit2=strright; 
	                        UpdateData(FALSE); 
							AfxMessageBox(L"2"); 
							////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
			//添加一个汉字,设置光标到该汉字之后 
							//添加一个汉字,设置光标到该汉字之后 
							//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
							//m_edtSelectedWord.SetSel(nLenth,nLenth); 
							//m_edtSelectedWord.SetFocus(); 
							 
						} 
						 
					} 
					 
					 
					break; 
  } 
		case '3': 
			{ 
				if(!m_bIsPinYin) 
				{ 
					if(Times==6) 
						return 1; 
					 
					Times=Times+1; 
					CString TempString1; 
					CString TempString2; 
					CString TempString3; 
					 
					if(Times==1) 
					{ 
						AllResult[1].Add("d"); 
						AllResult[1].Add("e"); 
						AllResult[1].Add("f"); 
						Result[1].Add("e"); 
					} 
					else 
					{ 
						 
						for(int i=0;i2) 
							{ 
								m_LastWord = str.Mid(2,1);		//取第3个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								if ((strleft=="")&&(strright=="")) 
								{ 
									m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
									m_SelectedWord = m_SelectedWord + m_LastWord; 
								} 
								else  
								{ 
									m_SelectedWord=strleft+m_LastWord+strright; 
									strleft=""; 
									strright=""; 
								} 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
						////////////////////////////////// 
					if (m_nClickTimes==1) 
					{ 
						CString m_LastWord; 
						m_LastWord = m_strCurrentString.Mid(2,1);			//取第3个汉字 
						 
						//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
						//m_SelectedWord = m_SelectedWord + m_LastWord; 
						if ((strleft=="")&&(strright=="")) 
						{ 
							m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
							m_SelectedWord = m_SelectedWord + m_LastWord; 
						} 
						else  
						{ 
							m_SelectedWord=strleft+m_LastWord+strright; 
							strleft=""; 
							strright=""; 
						} 
						m_edtSelectedWord.SetWindowText(m_SelectedWord); 
							////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                 nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
						//添加一个汉字,设置光标到该汉字之后 
						//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
						//m_edtSelectedWord.SetSel(nLenth,nLenth); 
						//m_edtSelectedWord.SetFocus(); 
					break; 
					} 
					} 
				} 
				break; 
		} 
		case '4': 
			{ 
				if(!m_bIsPinYin) 
				{ 
					if(Times==6) 
						return 1; 
					 
					Times=Times+1; 
					CString TempString1; 
					CString TempString2; 
					CString TempString3; 
					 
					if(Times==1) 
					{ 
						AllResult[1].Add("g"); 
						AllResult[1].Add("h"); 
						AllResult[1].Add("i"); 
					} 
					else 
					{ 
						 
						for(int i=0;i3) 
							{ 
								m_LastWord = str.Mid(3,1);		//取第4个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								m_SelectedWord=strleft+m_LastWord+strright; 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
						////////////////////////////////// 
						if (m_nClickTimes==1) 
						{ 
						CString m_LastWord; 
						m_LastWord = m_strCurrentString.Mid(3,1);				//取第4个汉字 
						//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
						//m_SelectedWord = m_SelectedWord + m_LastWord; 
						m_SelectedWord=strleft+m_LastWord+strright; 
						m_edtSelectedWord.SetWindowText(m_SelectedWord); 
							////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
						//添加一个汉字,设置光标到该汉字之后 
						//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
						//m_edtSelectedWord.SetSel(nLenth,nLenth); 
						//m_edtSelectedWord.SetFocus(); 
						break; 
						} 
					} 
				} 
				 
				break; 
			} 
 
	case '5': 
		{ 
			if(!m_bIsPinYin) 
			{ 
				if(Times==6) 
					return 1; 
				 
				Times=Times+1; 
				CString TempString1; 
				CString TempString2; 
				CString TempString3; 
				 
				if(Times==1) 
				{ 
					AllResult[1].Add("j"); 
					AllResult[1].Add("k"); 
					AllResult[1].Add("l"); 
				} 
				else 
				{ 
					 
					for(int i=0;i4) 
							{ 
								m_LastWord = str.Mid(4,1);		//取第4个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								m_SelectedWord=strleft+m_LastWord+strright; 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
						////////////////////////////////// 
					if (m_nClickTimes==1) 
					{ 
						CString m_LastWord; 
					m_LastWord = m_strCurrentString.Mid(4,1);				//取第5个汉字 
					//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
					//m_SelectedWord = m_SelectedWord + m_LastWord; 
					m_SelectedWord=strleft+m_LastWord+strright; 
					m_edtSelectedWord.SetWindowText(m_SelectedWord); 
						////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
					//添加一个汉字,设置光标到该汉字之后 
					//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
					//m_edtSelectedWord.SetSel(nLenth,nLenth); 
					//m_edtSelectedWord.SetFocus(); 
					break; 
					} 
					} 
			} 
			break; 
			} 
		case '6': 
			{ 
				if(!m_bIsPinYin) 
				{ 
					if(Times==6) 
						return 1; 
					 
					Times=Times+1; 
					CString TempString1; 
					CString TempString2; 
					CString TempString3; 
					 
					if(Times==1) 
					{ 
						AllResult[1].Add("m"); 
						AllResult[1].Add("n"); 
						AllResult[1].Add("o"); 
						Result[1].Add("o"); 
					} 
					else 
					{ 
						 
						for(int i=0;i5) 
							{ 
								m_LastWord = str.Mid(5,1);		//取第5个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								m_SelectedWord=strleft+m_LastWord+strright; 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
						////////////////////////////////// 
						if (m_nClickTimes==1) 
						{ 
						CString m_LastWord; 
						m_LastWord = m_strCurrentString.Mid(5,1);				//取第6个汉字 
						//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
						//m_SelectedWord = m_SelectedWord + m_LastWord; 
						m_SelectedWord=strleft+m_LastWord+strright; 
						m_edtSelectedWord.SetWindowText(m_SelectedWord); 
							////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
						//添加一个汉字,设置光标到该汉字之后 
						//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
						//m_edtSelectedWord.SetSel(nLenth,nLenth); 
						//m_edtSelectedWord.SetFocus(); 
						break; 
						} 
					} 
				} 
				break; 
 } 
		case '7': 
			{ 
				if(!m_bIsPinYin) 
				{ 
					if(Times==6) 
						return 1; 
					 
					Times=Times+1; 
					CString TempString1; 
					CString TempString2; 
					CString TempString3; 
					 
					if(Times==1) 
					{ 
						AllResult[1].Add("p"); 
						AllResult[1].Add("q"); 
						AllResult[1].Add("r"); 
						AllResult[1].Add("s"); 
					} 
					else 
					{ 
						 
						for(int i=0;i6) 
							{ 
								m_LastWord = str.Mid(6,1);		//取第6个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								m_SelectedWord=strleft+m_LastWord+strright; 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
						if (m_nClickTimes==1) 
						{ 
						CString m_LastWord; 
						m_LastWord = m_strCurrentString.Mid(6,1);				//取第7个汉字 
						//m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
						//m_SelectedWord = m_SelectedWord + m_LastWord; 
						m_SelectedWord=strleft+m_LastWord+strright; 
						m_edtSelectedWord.SetWindowText(m_SelectedWord); 
							////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
						//添加一个汉字,设置光标到该汉字之后 
						//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
						//m_edtSelectedWord.SetSel(nLenth,nLenth); 
						//m_edtSelectedWord.SetFocus(); 
						break; 
						} 
					} 
				} 
				break; 
		} 
 
	case '8': 
		{ 
	if(!m_bIsPinYin) 
	{ 
		if(Times==6) 
			return 1; 
 
		Times=Times+1; 
		CString TempString1; 
		CString TempString2; 
		CString TempString3; 
 
		if(Times==1) 
		{ 
			AllResult[1].Add("t"); 
			AllResult[1].Add("u"); 
			AllResult[1].Add("v"); 
		} 
		else 
		{ 
 
			for(int i=0;i7) 
							{ 
								m_LastWord = str.Mid(7,1);		//取第7个汉字 
								 
								//m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								//UpdateData(); 
								//m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								//UpdateData(TRUE); 
								m_SelectedWord=strleft+m_LastWord+strright; 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
					/*	if (m_nClickTimes==1) 
						{ 
						CString m_LastWord; 
						m_LastWord = m_strCurrentString.Mid(7,1);				//取第7个汉字 
						m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
						m_SelectedWord = m_SelectedWord + m_LastWord; 
						m_edtSelectedWord.SetWindowText(m_SelectedWord); 
							////////////////////////////////////////////////////////// 
							for(int i=0;i<3755;i++) 
							{ 
								if (!wcscmp((CString)Lx_Index[i].SY,m_LastWord)) 
								{ 
									nStartPinYin=2; 
					                nEndPinYin=3; 
									m_MyEdit.SetFocus(); 
									m_MyEdit.SetWindowText(DispayString((CString)Lx_Index[i].HZ)); 
									//m_MyEdit.SetWindowText((CString)Lx_Index[i].HZ); 
									m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
									m_strCurrentString=(CString)Lx_Index[i].HZ; 
									break; 
								} 
							} 
							////////////////////////////////////////////////////////// 
						//添加一个汉字,设置光标到该汉字之后 
						//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
						//m_edtSelectedWord.SetSel(nLenth,nLenth); 
						//m_edtSelectedWord.SetFocus(); 
						break; 
						}*/ 
					} 
				} 
				break; 
 
 
      } 
	case '9': 
		{ 
	if(!m_bIsPinYin) 
	{ 
		if(Times==6) 
			return 1; 
 
		Times=Times+1; 
		CString TempString1; 
		CString TempString2; 
		CString TempString3; 
 
		if(Times==1) 
		{ 
			AllResult[1].Add("w"); 
			AllResult[1].Add("x"); 
			AllResult[1].Add("y"); 
			AllResult[1].Add("z"); 
		} 
		else 
		{ 
 
			for(int i=0;i8) 
							{ 
								m_LastWord = str.Mid(8,1);		//取第8个汉字 
								 
								m_edtSelectedWord.GetWindowText(m_SelectedWord);  
								UpdateData(); 
								m_SelectedWord = m_SelectedWord + m_LastWord;	//m_SelectedWord +=m_LastWord 
								UpdateData(TRUE); 
								m_edtSelectedWord.SetWindowText(m_SelectedWord); 
								UpdateData(FALSE); 
								//添加一个汉字,设置光标到该汉字之后 
								/////by chen 2006.6.21 
								//int nLenth = m_edtSelectedWord.GetWindowTextLength(); 
								//m_edtSelectedWord.SetSel(nLenth,nLenth); 
								//m_edtSelectedWord.SetFocus(); 
								break; 
							} 
							else 
								break; 
						} 
 
					} 
				} 
				break; 
 
 } 
 case '0': 
	 { 
		 if(!m_bIsShuZi) 
		 { 
			 CString m_LastWord1; 
			 m_LastWord1 = L"0"; 
			 //m_edtSelectedWord.GetWindowText(m_SelectedWord); //06-5-03 
			// m_SelectedWord = m_SelectedWord + m_LastWord1; 
			 m_SelectedWord=strleft+m_LastWord1+strright; 
			 m_edtSelectedWord.SetWindowText(m_SelectedWord);//是数字,则再加1显示 
			 /////by chen 2006.6.21 
			 //int nLenth = m_edtSelectedWord.GetWindowTextLength();//添加一个汉字,设置光标到该汉字之后 
			// m_edtSelectedWord.SetSel(nLenth,nLenth); 
			 //m_edtSelectedWord.SetFocus(); 
		 } 
		 break; 
	 } 
 case VK_SHIFT: 
	 { 
		 CString str; 
		 m_edtSelectedWord.GetWindowText(m_SelectedWord); 
		 str = m_SelectedWord.Mid(0,m_SelectedWord.GetLength() - 1); 
		 m_edtSelectedWord.SetWindowText(str); 
		 UpdateData(FALSE); 
	  
	 } 
 
		case VK_LEFT: 
			{						 
				int k=0; 
				CString string,EqualStr; 
				if(peditContent==CWnd::GetFocus()) 
				{ 
                     return CDialog::PreTranslateMessage(pMsg);//2006.6.13 
				} 
				if (!m_bIsPinYin) 
				{ 
					if (Result[banshuinTimes].GetSize()!=0) 
					{ 
						int Indexcount=0; 
						IndexZuHe--; 
						if (IndexZuHe<1) 
							IndexZuHe=1; 
						for (int i=0;i=0) 
						 { 
							 m_MyEdit.SetFocus(); 
							 m_MyEdit.SetSel(nStartPinYin,nEndPinYin);				   
						 } 
						 else 
						 { 
							 nStartPinYin=2; 
							 nEndPinYin=3; 
							 m_MyEdit.SetFocus(); 
							 m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
						 } 
					} 
				 
				else if (m_bIsBiaoDian) 
				{ 
					CString str; 
					nStartBiaoDian--; 
					nEndBiaoDian--; 
					m_MyEdit.GetWindowText(str); 
					if(nStartBiaoDian>=0) 
					{ 
						m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartBiaoDian,nEndBiaoDian);				 
					} 
					else 
					{ 
						nStartBiaoDian=0; 
						nEndBiaoDian=1; 
                        m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartBiaoDian,nEndBiaoDian); 
					} 
                } 
				else if (m_bIsZiMu) 
				{ 
					CString str; 
					nStartZiMu--; 
					nEndZiMu--; 
					m_MyEdit.GetWindowText(str); 
					if(nStartZiMu>=0) 
					{ 
						m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartZiMu,nEndZiMu);				 
					} 
					else 
					{ 
						nStartZiMu=0; 
						nEndZiMu=1; 
                        m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartZiMu,nEndZiMu); 
					} 
				} 
				else 
					break; 
 
						//m_bIsBiaoDian = FALSE; 
			break; 
		} 
		case VK_RIGHT: 
            {					 
				int k=0; 
				CString string,EqualStr; 
				if(peditContent==CWnd::GetFocus()) 
				{ 
                      	return CDialog::PreTranslateMessage(pMsg);//2006.6.13 
				} 
				if (!m_bIsPinYin) 
				{ 
					/*if(Result[banshuinTimes].GetSize()!=0) 
					{ 
						int Indexcount=0; 
						IndexZuHe++; 
						if (IndexZuHe>Result[banshuinTimes].GetSize()) 
							IndexZuHe=Result[banshuinTimes].GetSize(); 
						for (int i=0;i=nEndPinYin) 
						 { 
							 m_MyEdit.SetFocus(); 
							 m_MyEdit.SetSel(nStartPinYin,nEndPinYin);				   
						 } 
						 else 
						 { 
							 nStartPinYin=nStartPinYin-4; 
							 nEndPinYin=nEndPinYin-4; 
							 m_MyEdit.SetFocus(); 
							 m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
						 } 
					} 
			  
                else if (m_bIsBiaoDian) 
				{ 
					CString str; 
					nStartBiaoDian++; 
					nEndBiaoDian++; 
					m_MyEdit.GetWindowText(str); 
					if(str.GetLength()>=nEndBiaoDian) 
					{ 
						m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartBiaoDian,nEndBiaoDian);				 
					} 
					else 
					{ 
						nStartBiaoDian=str.GetLength()-1; 
						nEndBiaoDian=str.GetLength(); 
                        m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartBiaoDian,nEndBiaoDian); 
					} 
                } 
				else if (m_bIsZiMu) 
				{ 
					CString str; 
					nStartZiMu++; 
					nEndZiMu++; 
					m_MyEdit.GetWindowText(str); 
					if(str.GetLength()>=nEndZiMu) 
					{ 
						m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartZiMu,nEndZiMu);				 
					} 
					else 
					{ 
						nStartZiMu=str.GetLength()-1; 
						nEndZiMu=str.GetLength(); 
                        m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartZiMu,nEndZiMu); 
					} 
				} 
				else 
					break; 
 
		 
					break; 
				} 
		case VK_UP: 
			{ 
				 
				int nCount = m_edtSelectedWord.GetLineCount();	//获得Edit有多少行 
				int nMaxLenth = 0;	 
				if(peditContent==CWnd::GetFocus()) 
				{ 
                      	return CDialog::PreTranslateMessage(pMsg);//2006.6.13 
				} 
				if((UpSign==TRUE)&&(updownsign==1)) 
				{ 
				  	CString tempUp,str; 
					nStartPinYin=2; 
					nEndPinYin=3; 
					//m_MyEdit.GetWindowText(strtemp); 
					//strindex=strtemp.Mid(nStartPinYin,nEndPinYin-nStartPinYin); 
 
					tempUp = DictionaryArray.GetAt(m_nShunXu).HanZi; 
					 
					if(m_nTimes2 == 1) 
					{ 
						return 1; 
					} 
					m_nTimes2 -= 1; 
					str = tempUp.Mid((m_nTimes2-1) * 7, 7); 
                    m_MyEdit.SetWindowText(DispayString(str));//确定后显示与当前拼音匹配的6个汉字[占12字节]		 
					//m_MyEdit.SetSel(0,-1); 
					//m_MyEdit.ReplaceSel(str,true); 
					m_MyEdit.SetFocus(); 
					m_MyEdit.SetSel(nStartPinYin,nEndPinYin); 
					m_strCurrentString=str; 
				} 
				else if(m_bIsZiMu) 
				{									 
				CString tempUp; 
				nStartZiMu=0; 
				nEndZiMu=1; 
				if (m_nTimes==1) 
					return 1; 
				m_nTimes-=1; 
				tempUp = ZiMuString.Mid((m_nTimes-1) * 7, 7); 
				m_MyEdit.SetSel(0,-1); 
				m_MyEdit.ReplaceSel(tempUp,true); 
				m_MyEdit.SetFocus(); 
				m_MyEdit.SetSel(nStartZiMu,nEndZiMu); 
				} 
				else if (m_bIsBiaoDian) 
				{ 
				  
					CString tempUp; 
					nStartBiaoDian=0; 
					nEndBiaoDian=1; 
					if(m_nTimes1 == 1) 
					{ 
						return 1; 
					} 
					m_nTimes1 -= 1; 
					if(BiaoDianString.GetLength()SetWindowText(L"拼音"); 
						UpdateData(FALSE); 
						Times=0; 
						banshuinTimes=0; 
						updownsign=0;//表示是第几次按下UP OR DOWN  
						for(int j=0;j<7;j++)												//Clear All Result 
						{ 
							AllResult[j].RemoveAll(); 
							Result[j].RemoveAll(); 
						} 
						m_MyEdit.SetSel(0,-1); 
						UpdateData(TRUE); 
						m_MyEdit.ReplaceSel(str,true); 
						UpdateData(FALSE); 
						break; 
						} 
					case 1: 
						{ 
						CString str1=""; 
						m_bIsPinYin = TRUE; 
						m_bIsShuZi = FALSE;						 
						m_bIsZiMu = FALSE; 
						m_bIsBiaoDian = FALSE; 
						UpSign=FALSE; 
					    DownSign=FALSE; 
						m_nClickTimes=0; 
						UpdateData(TRUE); 
						GetDlgItem(IDC_STATIC_ONE)->SetWindowText(L"数字"); 
						UpdateData(FALSE); 
						m_MyEdit.SetSel(0,-1); 
						UpdateData(TRUE); 
						m_MyEdit.ReplaceSel(str1,true); 
						UpdateData(FALSE); 
						break; 
						} 
					case 2: 
						{ 
						m_bIsPinYin = TRUE; 
						m_bIsShuZi = TRUE; 
						m_bIsZiMu = TRUE; 
						m_bIsBiaoDian = FALSE; 
						UpSign=FALSE; 
					    DownSign=FALSE; 
						nStartZiMu=0; 
						nEndZiMu=1; 
						m_nClickTimes=0; 
						UpdateData(TRUE); 
						GetDlgItem(IDC_STATIC_ONE)->SetWindowText(L"字母"); 
						UpdateData(FALSE);						 
						m_strCurrentString.Empty();										 
						m_strCurrentString = ZiMuString.Mid(0,7); 
						m_MyEdit.SetSel(0,-1); 
						m_MyEdit.ReplaceSel(m_strCurrentString,true); 
						m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartZiMu,nEndZiMu); 
						m_nTimes=1; 
					break; 
						} 
					case 3:  
						{ 
							m_bIsBiaoDian = TRUE;							 
							m_bIsZiMu = FALSE;							 
							m_bIsPinYin = TRUE; 
							m_bIsShuZi = TRUE; 
							nStartBiaoDian=0; 
							nEndBiaoDian=1; 
							UpdateData(TRUE); 
							UpSign=FALSE; 
					        DownSign=FALSE; 
							m_nClickTimes=0; 
							GetDlgItem(IDC_STATIC_ONE)->SetWindowText(L"标点");	 
							UpdateData(FALSE); 
							m_strCurrentString.Empty();	 
							m_strCurrentString = BiaoDianString.Mid(0,7); 
							m_MyEdit.SetWindowText(m_strCurrentString);						//在Edit中显示出翻页后的结果							 
							if(BiaoDianString.GetLength()<7*(m_nTimes1+1)) 
								m_nTimes1 = 0; 
							else 
								m_nTimes1++; 
							m_bIsShuZi = TRUE; 
			                m_MyEdit.SetFocus(); 
						m_MyEdit.SetSel(nStartBiaoDian,nEndBiaoDian);				 
 
						break; 
						} 
						 
					default: 
						break;						 
						 
					} 
					nTimes++; 
					 
					 
				} 
		 
	 
		  } 
 return 1; 
 
}	 
    
	return CDialog::PreTranslateMessage(pMsg); 
} 
 
int CT9ModuleDlg::CharToUnicode(WCHAR *pwszUni, char *pszChi, int nCount, int nType) 
{ 
    int x = MultiByteToWideChar(nType,0,pszChi,-1,pwszUni,nCount); 
		return x; 
} 
 
void CT9ModuleDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	 
	//CDialog::OnOK(); 
} 
 
void CT9ModuleDlg::OnTimer(UINT nIDEvent)  
{ 
	CDialog::OnTimer(nIDEvent); 
} 
 
CString CT9ModuleDlg::DispayString(CString str) 
{ 
	CString StrMid,StrRes; 
	if (str.GetLength()>=7) 
	{ 
		for (int j=0;j<7;j++) 
		{ 
			StrMid.Format(L"%d:",j+1); 
			StrMid+=(CString)str[j]; 
			StrMid+=" "; 
			StrRes+=StrMid; 
		} 
	} 
	else 
	{ 
		for(int j=0;j