
Key Buffer Problem ATL Windows RichEdit Control Control
Hi,
I have developed ATL windows control by Superclassing
RichEdit20.dll
I have implemented all methods and events requied for a normal
Richedit Control. To make the control compatible with Microsoft's
RichTextBox I have developed an adapter OCX by using the ATL RichEdit
Control.
Now in a normal MS RichText Box if the user does not need a keyevent,
he/she can set the Keycode parameter to zero.
Consider the following code in VB:
Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As
Integer)
If KeyCode <> vbKeyMenu And Shift = 4 Then KeyCode = 0
End Sub
This code is used to prevent user from typing special characters using
ALT & num key combinations, e.g. ALT + 0169 = ?
In above case if user types ALT + 0169 nothing gets printed on the MS
TextBox.
Now if I follow the above action and type character "A" then it gets
printed on the MS TextBox.
To simulate the KeyCode = 0 effect I have implemented a logic that
skips the default KeyHandler function if the user sets KeyCode=0,there
by not allowing the key to be printed on to my control. This works
fine. But when I implement the above mentioned case, the behavior is
similar upto the point that the ALT + 0169 is not printed. Now if I
type character "A",instead of "A" appearing on the control, "?"
appears.
It seems the ? character is not removed from the KeyBuffer.
Can any one please explain the behavior and suggest a remedy for it.
Hope I have defined the problem properly.
Thanks in advance,
regards,
Rahul