POINT point;
GetCursorPos(&point);
PostMessageW(WindowFromPoint(point),WM_PASTE ,0,0);我在控制台程序的钩子里面使用上代码
为什么记本事,或别的可以输入的输入框内 没有效果
剪贴板确定有内容
我用 keybd_event 发送CTRL+V 都成功的

解决方案 »

  1.   

    板块涉及的内容会直接处理API
      

  2.   

    WindowFromPoint(point)拿到的不一定是edit控件的句柄,请确认
    1)你的鼠标位置在目标窗口上。
    2)如有必要,需要对WindowFromPoint找到窗口找子窗口(确认找到了edit控件的句柄)
      

  3.   

    我用spy++ 查看了,我得到的句柄是正确的,我的鼠标放在记事本的输入框,得到的是输入框的HWND,我用SPY++得到的输入框的句柄是一样的
      

  4.   

    你SetClipboardData的时候是用的CF_TEXT格式吗?WM_PASTE Message
    An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format. 
      

  5.   

    谢谢,我用的是unicode 郁闷哈