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.
精彩评论