novasdream / tibiaapi

Automatically exported from code.google.com/p/tibiaapi
MIT License
0 stars 1 forks source link

Malfunction of Client.Input #214

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If I try to write some string using
Client.Input.SendString("qwoiudoiasjkzocbn");
It won't write it correctly. It writes few letters, then everything is erasing 
and repeating until the end of the string.

I'm using last version of TibiaApi. My operating system is Windows XP sp2.

This is happening when I'm trying to write in the saying window. I didn't 
tested it with login/password but it seems it's working with editing hotkey.

Original issue reported on code.google.com by sebiw...@gmail.com on 12 Sep 2010 at 2:04

GoogleCodeExporter commented 8 years ago
This is because it's sending messages too quickly. There needs to be a small 
delay after each SendKey in the SendString loop. Using PostMessage, instead of 
SendMessage, may resolve it to.

public void SendString(string s)
{
    foreach (var c in s)
    {
        SendKey(Convert.ToInt32(c));
        System.Threading.Thread.Sleep(100);
    }
}

Original comment by joebingham07@gmail.com on 12 Sep 2010 at 7:40

GoogleCodeExporter commented 8 years ago
PostMessage is a good idea; this does not need to be synchronous.

Original comment by ian320 on 13 Sep 2010 at 6:09

GoogleCodeExporter commented 8 years ago
Fixed in r834. Just needed to send the character message, didn't need to send 
key down/up.

Original comment by joebingham07@gmail.com on 29 Sep 2010 at 6:24