没有试过...
不知道用sendmessage可以不?给按钮发一个鼠标点击消息,模拟一个鼠标点击事件...

解决方案 »

  1.   

    用WinSight32这个工具找到Button的句柄,然后用PostMessage函数发WM_LBUTTONDOWN消息给按钮,前提是你要按的按钮是有Window句柄的,比如TButton或者TBitButton。
      

  2.   

    发送一个BM_Click的消息给他以下是Win32 SDK中的帮助An application sends a BM_CLICK message to simulate the user clicking a button. This message causes the button to receive a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and the button's parent window to receive a BN_CLICKED notification message.BM_CLICK  
    wParam = 0;     // not used; must be zero 
    lParam = 0;     // not used; must be zero 
     ParametersThis message has no parameters. Return ValuesThis message does not return a value.
      

  3.   

    我看他是想要动态的找到该句柄,然后再SENDMESSAGE。
    问题是如何不通过第三方工具来找该句柄?
      

  4.   

    呵呵,这个问题我已经试验成功了。
    先取得该按钮的句柄
    然后
      SendMessage(yourhandle, WM_LBUTTONDOWN, 0, 0);
      SendMessage(yourhandle, WM_LBUTTONUP, 0, 0);其实也就是模拟鼠标按下,再松开的动作。
      

  5.   

    非常感谢大家,请问postMessage(handle,wm_...,lParam ,wParam )中后面
    lParam ,wParam 有什么用,随便设吗?
      

  6.   

    当然不是随便设的,根据不同的消息,它们的意义不同的。具体查msdn吧。