Index: /trunk/KeyComboDlg.cpp
===================================================================
--- /trunk/KeyComboDlg.cpp	(revision 834)
+++ /trunk/KeyComboDlg.cpp	(revision 835)
@@ -72,7 +72,12 @@
 void CKeyComboDlg::OnBnClickedOk()
 {
-	char ch[10];	
-	m_eKey.GetLine(0,ch,1);
-	m_strValue = ch;
+	char ch[8];	
+	memset(ch, 0, sizeof(ch));
+	if (m_eKey.GetLine(0, ch, sizeof(ch)))
+	{
+		m_strValue = ch[0];
+		m_strValue.MakeUpper();
+	}
+
 	OnOK();
 }
@@ -82,5 +87,4 @@
 	CDialog::OnActivate(nState, pWndOther, bMinimized);
 	m_eKey.SetFocus();
-	// TODO: Add your message handler code here
 }
 
@@ -92,7 +96,6 @@
 	// function and call CRichEditCtrl().SetEventMask()
 	// with the ENM_CHANGE flag ORed into the mask.
-	char ch[10];
-	m_eKey.GetLine(0,ch,1);
-	CString strLine(ch);
+
+	//Recursion guard
 	static bool busy = false;
 	if (busy)
@@ -100,11 +103,17 @@
 	busy = true;
 
+	char ch[8];
+	memset(ch, 0, sizeof(ch));
+	if (!m_eKey.GetLine(0, ch, sizeof(ch)))
+		return;
+
+	CString strLine(ch);
+	strLine.MakeUpper();
 	if (!strLine.Trim().IsEmpty())
 	{
 		CString strTmp(m_strRegKey.MakeUpper());
-		strLine.MakeUpper();
 		if (strTmp.Find(strLine[0]) == -1) {
 			//Invalid selection, clear the entry
-			m_eKey.SetWindowText("m");
+			m_eKey.Undo();
 
 			//TODO: This works only with XP/Vista. What about others?
