开发者

c# press a button from a window using user32 dll

开发者 https://www.devze.com 2023-02-27 03:35 出处:网络
I have a handler hwd over a window. How can I programatic开发者_StackOverflowally press the button the the window has?ThxYou can use the Send Message function to simulate the button click.

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

精彩评论

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