PostMessage不适用于WM_PASTE,mfc [英] PostMessage not working for WM_PASTE , mfc

查看:200
本文介绍了PostMessage不适用于WM_PASTE,mfc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,点击按钮上有一个按钮我试图将已经可用的文本粘贴到记事本。我的应用程序首先收集文本并将其放在剪贴板上(这非常正常),我遇到了粘贴部分的问题。这是代码,请让我知道我哪里出错。



 CWnd * pCwnd = FindWindow(NULL,_T(< span class =code-string>  Untitled  -  Notepad)); 
HWND句柄= pCwnd-> GetSafeHwnd();
pCwnd-> PostMessageA(WM_PASTE, 0 0 );



我正在使用记事本来测试它,因此名称是(Untitled - Notepad)。请帮我。在此先感谢。

解决方案

阅读:



http://msdn.microsoft.com/en-us/library/windows/desktop/ms649028% 28v = vs.85%29.aspx



WM_PASTE被发送到编辑控件或组合框。

你将消息发送到主窗口。



您必须找到子窗口



使用FindWindowEx功能

I have an application which has a button on Click of button am trying to paste the text already available to Notepad. My application gathers the text first and puts it on the clipboard(this is working perfectly fine), I am facing problem with the Paste part. Here is the code, Please let me know where am i going wrong.

CWnd *pCwnd = FindWindow(NULL, _T("Untitled - Notepad"));
    HWND handle = pCwnd->GetSafeHwnd();
    pCwnd->PostMessageA(WM_PASTE,0,0);


I am using Notepad to test it so the name is ("Untitled - Notepad"). Please help me. Thanks in advance.

解决方案

Read This:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms649028%28v=vs.85%29.aspx

WM_PASTE is sended to an edit control or a combo box.
You are sending the message to the main window.

You have to find the child window

Use FindWindowEx function


这篇关于PostMessage不适用于WM_PASTE,mfc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆