用DELPHI做个程序,窗体有按钮可以调用另外一个text.EXE,请问如何取得改界面的EDIT输入框值呢?

解决方案 »

  1.   

    FindWindow,遍历控件,找到你要的
      

  2.   

    FindWindowEx
    SendMessage
    WM_GETTEXT
      

  3.   

    也可以WindowFromPoint取得鼠标所在位置的句柄,然后GetWindowText
      

  4.   

    GetWindowText貌似不行,要发送WM_GETTEXT
      

  5.   

    GetWindowText Function--------------------------------------------------------------------------------The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application.
      

  6.   

    思路:
    1. 获得另一程序的Edit的值,要发送WM_GETTEXT消息
    2. 要发送消息,就得先获得Edit的句柄
    3. 而获得Edit的句柄,就得使用FindWindowEx来从所在窗体找Edit
    4. 要使用FindWindowEx,就得先获得所在窗体的句柄
    5. 可以通过FindWindow或其它API获得所在窗体的句柄