Hi
My bot uses keypresses to control char. I send wsad and camera up/down to move it. Everything was fine for 2years. But since this weekend it started to disconnect in 1-10 min after starting bot. It's quite cureous that problem appeared only on 2 realms first on panda zones, now more realms involved.
Investigating the case i found a keypressing sending with PostMessage to be the reason of disconnects. Moreover keydown couses disconnect, keyup is ok.
To find it i held few tests:
1st test:
Code:
for (int i = 0; i < 1000; i++)
{
Key.Down(Key.a, wow.Handle);
Key.Up(Key.a, wow.Handle);
}
result - disconnect in 2 seconds,
2nd test:
Code:
for (int i = 0; i < 1000; i++)
{
Key.Down(Key.a, wow.Handle);
}
result - disconnect in 2 seconds,
3rd test:
Code:
for (int i = 0; i < 1000; i++)
{
Key.Up(Key.a, wow.Handle);
}
result - all ok.
where
Code:
public static bool Down(uint key, IntPtr hWnd)
{
return PostMessage(hWnd, (uint)WM.WM_Keydown, (IntPtr)key, IntPtr.Zero);
}
public static bool Up(uint key, IntPtr hWnd)
{
return PostMessage(hWnd, (uint)WM.WM_Keyup, (IntPtr)key, IntPtr.Zero);
}
private enum WM
{
WM_Keydown = 0x100,
WM_Keyup = 0x101
}
Depending on zone and realm 1 and 2 my be ok. One more strange thing - disconnects take place only when fly mount is used, ground works fine.
If someone has faced the same problem please advise some way to solve it.