开发者

c# press a button from a window using user32 dll

I have a handler hwd over a window. How can I programatic开发者_StackOverflowally press the button the the window has?Thx


You can use the Send Message function to simulate the button click.

Here can find a small example.

  SendMessage(ptrChild, WM_LBUTTONDOWN, 0, IntPtr.Zero);   //send left button mouse down
  SendMessage(ptrChild, WM_LBUTTONUP, 0, IntPtr.Zero);     //send left button mouse up
  SendMessage(ptrChild, BM_SETSTATE,1 , IntPtr.Zero);     //send change state

Take a look at this MSDN page, explain all the messages you can send with Send Message Function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜