Hi!
I have a little problem, I'm not sure where it comes from.
I'm posting click-messages to window-handles in a loop.
SendMessage(h, Msg1, param, MAKELPARAM(wx, wy));
SendMessage(h, Msg2, param, MAKELPARAM(wx, wy));
After that, I change the handles parent from my application to desktop.
SetParent(handle, GetDesktopWindow());
This works perfectly, for the first handle in the loop. The second handle (and all others after that), though, doesnt receive any clicks. I'm not sure why this is happening, but as soon as I add
std::this_thread::sleep_for(std::chrono::milliseconds(50));
after the SendMessages and before the SetParent, it works perfectly fine. Can anyone explain to me why this is happening, and maybe give me a better alternative than std::sleep? I'm afraid this might not work 100% and slows down the program more than necessary most of the time.
Thanks in advance.