SendMessageTimeout with BM_CLICK never return

227 views Asked by At

I'm trying to send BM_CLICK to a window in another process.

When the target button get clicked, the target window pops up a modal dialog, then my calling thread never return even I send the timeout to 1 second.

SendMessageTimeout(handle, BM_CLICK, 0, 0, SMTO_ABORTIFHUNG | SMTO_NORMAL, 1000, NULL);

What's the reason of this? Is there any idea I can prevent this?

There are some potential solutions:

  1. Use PostMessage with WM_LBUTTONDOWN and WM_LBUTTONUP to simulate the click
  2. If I remember correctly, PostMessage doesn't support BM_CLICK, isn't it?
0

There are 0 answers