|
I'm developing a logging application, where the user enters some text in a RichTextBox (RTB). I want to be able to replay the users actions in another RTB, just as if the user was typing the same thing all over again. I have tried to use SendKeys, but it has the following problems: 1. For some reason the Focus() method always returns false, which means I cannot focus the RTB, and it doesn't receive the keys. 2. I would prefer to avoid focus dependent solutions altogether. The only other option I can think of, is to alter the contents of the RTB through the SelectedText property, but that would require me to reverse engineer the RTB and find out, what all possible combinations of keystrokes does to the content of the RTB. This also has some associated problems: 1. It's error prone. I could easily overlook a key combination or have subtle differences in the output. 2. It's boring and not very elegant... Any clever ideas to solve my problem would be highly appreciated! |